1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 20:20:55 +00:00

Merge pull request #106 from 0x0001/master

new和api命令支持符号链接目录
This commit is contained in:
astaxie 2015-05-09 14:48:39 +08:00
commit fb17bcd4d5
2 changed files with 21 additions and 3 deletions

View File

@ -655,9 +655,17 @@ func checkEnv(appname string) (apppath, packpath string, err error) {
haspath := false haspath := false
wgopath := path.SplitList(gopath) wgopath := path.SplitList(gopath)
for _, wg := range wgopath { for _, wg := range wgopath {
wg, _ = path.EvalSymlinks(path.Join(wg, "src")) wg = path.Join(wg, "src")
if path.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) { if strings.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) {
haspath = true
appsrcpath = wg
break
}
wg, _ = path.EvalSymlinks(wg)
if strings.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) {
haspath = true haspath = true
appsrcpath = wg appsrcpath = wg
break break

12
new.go
View File

@ -73,13 +73,23 @@ func createApp(cmd *Command, args []string) int {
wgopath := path.SplitList(gopath) wgopath := path.SplitList(gopath)
for _, wg := range wgopath { for _, wg := range wgopath {
wg, _ = path.EvalSymlinks(path.Join(wg, "src"))
wg = path.Join(wg, "src")
if strings.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) { if strings.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) {
haspath = true haspath = true
appsrcpath = wg appsrcpath = wg
break break
} }
wg, _ = path.EvalSymlinks(wg)
if strings.HasPrefix(strings.ToLower(curpath), strings.ToLower(wg)) {
haspath = true
appsrcpath = wg
break
}
} }
if !haspath { if !haspath {