Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b18139f

Browse files
committed
Update problems.json location
1 parent 9dae074 commit b18139f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

‎pkg/leetcode/leetcode.go‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/tidwall/gjson"
1717
)
1818

19-
const RemoteProblems = "https://raw.githubusercontent.com/PPsteven/leetcode-tool/master/data/problems.json"
19+
const RemoteProblems = "https://raw.githubusercontent.com/PPsteven/leetcode-tool/master/problems.json"
2020

2121
type Meta struct {
2222
Index string
@@ -57,7 +57,7 @@ func NewLeetcode(config *config.Config) *Leetcode {
5757

5858
func DownloadFile(remoteFile string) error {
5959
// Create the file
60-
out, err := os.Create("data/problems.json")
60+
out, err := os.Create("problems.json")
6161
if err != nil {
6262
return err
6363
}
@@ -68,7 +68,7 @@ func DownloadFile(remoteFile string) error {
6868
}
6969
resp, err := client.Get(remoteFile)
7070
if err != nil {
71-
_ = os.Remove("data/problems.json")
71+
_ = os.Remove("problems.json")
7272
return err
7373
}
7474
defer resp.Body.Close()
@@ -83,7 +83,7 @@ func DownloadFile(remoteFile string) error {
8383
}
8484

8585
func (l *Leetcode) getAllProblem() ([]byte, error) {
86-
file, err := ioutil.ReadFile("data/problems.json")
86+
file, err := ioutil.ReadFile("problems.json")
8787
if err != nil && errors.Is(err, os.ErrNotExist) {
8888
fmt.Println(fmt.Sprintf("file problems.json not exists, start downloading from %s", RemoteProblems))
8989

@@ -92,7 +92,7 @@ func (l *Leetcode) getAllProblem() ([]byte, error) {
9292
log.Fatal(fmt.Errorf("download file failed: %v", err))
9393
}
9494

95-
file, err := ioutil.ReadFile("data/problems.json")
95+
file, err := ioutil.ReadFile("problems.json")
9696
if err != nil {
9797
return nil, fmt.Errorf("read file failed: %v", err)
9898
}
File renamed without changes.

‎script/leetcode_crawler.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def run(self):
171171
content = self.fetch_problem_content(v['titleSlug'])
172172
problems[k]["content"] = content
173173
i+=1
174-
with open('../data/problems.json', 'w') as f:
174+
with open('./problems.json', 'w') as f:
175175
json.dump(problems, f, ensure_ascii=False)
176176

177177

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /