File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -79,11 +79,14 @@ func runPost(cmd *base.Command, args []string) {
79
79
buf .WriteString ("\n ---\n " )
80
80
buf .WriteString (fmt .Sprintf ("\n ## [答案](https://github.com/openset/leetcode/tree/master/problems/%s)\n " , question .TitleSlug ))
81
81
filename := fmt .Sprintf (formatFilename , t .Format ("2006-01-02" ), question .TitleSlug )
82
- postType := "leetcode"
82
+ oldPath := path .Join (basePath , "leetcode" , filename )
83
+ newPath := path .Join (basePath , "_posts" , filename )
84
+ base .FilePutContents (oldPath , buf .Bytes ())
83
85
if inPosts [questionId ] {
84
- postType = "_posts"
86
+ _ = os .Rename (oldPath , newPath )
87
+ } else {
88
+ _ = os .Remove (newPath )
85
89
}
86
- base .FilePutContents (path .Join (basePath , postType , filename ), buf .Bytes ())
87
90
}
88
91
}
89
92
postTags ()
You can’t perform that action at this time.
0 commit comments