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) {
7979 buf .WriteString ("\n ---\n " )
8080 buf .WriteString (fmt .Sprintf ("\n ## [答案](https://github.com/openset/leetcode/tree/master/problems/%s)\n " , question .TitleSlug ))
8181 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 ())
8385 if inPosts [questionId ] {
84- postType = "_posts"
86+ _ = os .Rename (oldPath , newPath )
87+ } else {
88+ _ = os .Remove (newPath )
8589 }
86- base .FilePutContents (path .Join (basePath , postType , filename ), buf .Bytes ())
8790 }
8891 }
8992 postTags ()
You can’t perform that action at this time.
0 commit comments