beego: commentsrouter use the workPath fix #708
Showing
1 changed file
with
5 additions
and
5 deletions
| ... | @@ -114,7 +114,7 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat | ... | @@ -114,7 +114,7 @@ func parserComments(comments *ast.CommentGroup, funcName, controllerName, pkgpat |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | func genRouterCode() { | 116 | func genRouterCode() { |
| 117 | os.Mkdir(path.Join(AppPath, "routers"), 0755) | 117 | os.Mkdir(path.Join(workPath, "routers"), 0755) |
| 118 | Info("generate router from comments") | 118 | Info("generate router from comments") |
| 119 | var globalinfo string | 119 | var globalinfo string |
| 120 | for k, cList := range genInfoList { | 120 | for k, cList := range genInfoList { |
| ... | @@ -148,7 +148,7 @@ func genRouterCode() { | ... | @@ -148,7 +148,7 @@ func genRouterCode() { |
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | if globalinfo != "" { | 150 | if globalinfo != "" { |
| 151 | f, err := os.Create(path.Join(AppPath, "routers", "commentsRouter.go")) | 151 | f, err := os.Create(path.Join(workPath, "routers", "commentsRouter.go")) |
| 152 | if err != nil { | 152 | if err != nil { |
| 153 | panic(err) | 153 | panic(err) |
| 154 | } | 154 | } |
| ... | @@ -158,8 +158,8 @@ func genRouterCode() { | ... | @@ -158,8 +158,8 @@ func genRouterCode() { |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | func compareFile(pkgRealpath string) bool { | 160 | func compareFile(pkgRealpath string) bool { |
| 161 | if utils.FileExists(path.Join(AppPath, lastupdateFilename)) { | 161 | if utils.FileExists(path.Join(workPath, lastupdateFilename)) { |
| 162 | content, err := ioutil.ReadFile(path.Join(AppPath, lastupdateFilename)) | 162 | content, err := ioutil.ReadFile(path.Join(workPath, lastupdateFilename)) |
| 163 | if err != nil { | 163 | if err != nil { |
| 164 | return true | 164 | return true |
| 165 | } | 165 | } |
| ... | @@ -187,7 +187,7 @@ func savetoFile(pkgRealpath string) { | ... | @@ -187,7 +187,7 @@ func savetoFile(pkgRealpath string) { |
| 187 | if err != nil { | 187 | if err != nil { |
| 188 | return | 188 | return |
| 189 | } | 189 | } |
| 190 | ioutil.WriteFile(path.Join(AppPath, lastupdateFilename), d, os.ModePerm) | 190 | ioutil.WriteFile(path.Join(workPath, lastupdateFilename), d, os.ModePerm) |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | func getpathTime(pkgRealpath string) (lastupdate int64, err error) { | 193 | func getpathTime(pkgRealpath string) (lastupdate int64, err error) { | ... | ... |
-
Please register or sign in to post a comment