mirror of
https://github.com/beego/bee.git
synced 2024-11-21 13:40:53 +00:00
fix #6
This commit is contained in:
parent
67428cafde
commit
398bb5ff09
@ -49,6 +49,7 @@ func createapp(cmd *Command, args []string) {
|
||||
os.Exit(2)
|
||||
}
|
||||
haspath := false
|
||||
appsrcpath := ""
|
||||
if crupath != path.Join(gopath, "src") {
|
||||
wgopath := strings.Split(gopath, ";")
|
||||
if len(wgopath) >= 1 {
|
||||
@ -56,6 +57,7 @@ func createapp(cmd *Command, args []string) {
|
||||
wg = wg + `\src`
|
||||
if strings.HasPrefix(crupath, wg) {
|
||||
haspath = true
|
||||
appsrcpath = path.Join(strings.TrimLeft(crupath, wg), args[0])
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -66,6 +68,7 @@ func createapp(cmd *Command, args []string) {
|
||||
for _, wg := range lgopath {
|
||||
if strings.HasPrefix(crupath, path.Join(wg, "src")) {
|
||||
haspath = true
|
||||
appsrcpath = path.Join(strings.TrimLeft(crupath, wg), args[0])
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -74,6 +77,7 @@ func createapp(cmd *Command, args []string) {
|
||||
|
||||
} else {
|
||||
haspath = true
|
||||
appsrcpath = path.Join(strings.TrimLeft(crupath, path.Join(gopath, "src")), args[0])
|
||||
}
|
||||
if !haspath {
|
||||
fmt.Println("can't create application outside of GOPATH")
|
||||
@ -109,7 +113,7 @@ func createapp(cmd *Command, args []string) {
|
||||
writetofile(path.Join(apppath, "views", "index.tpl"), indextpl)
|
||||
|
||||
fmt.Println("create main.go:", path.Join(apppath, "main.go"))
|
||||
writetofile(path.Join(apppath, "main.go"), strings.Replace(maingo, "{{.Appname}}", args[0], -1))
|
||||
writetofile(path.Join(apppath, "main.go"), strings.Replace(maingo, "{{.Appname}}", appsrcpath, -1))
|
||||
}
|
||||
|
||||
var appconf = `
|
||||
|
Loading…
Reference in New Issue
Block a user