diff --git a/cmd/commands/api/apiapp.go b/cmd/commands/api/apiapp.go index e1862beae..bf1076879 100644 --- a/cmd/commands/api/apiapp.go +++ b/cmd/commands/api/apiapp.go @@ -511,9 +511,9 @@ import ( ) func init() { - _, file, _, _ := runtime.Caller(1) - apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator)))) - beego.TestBeegoInit(apppath) + appPath, _ := filepath.Abs("..") + beego.TestBeegoInit(appPath) + beego.AppPath = appPath } // TestGet is a sample to run an endpoint test diff --git a/cmd/commands/new/new.go b/cmd/commands/new/new.go index 299f0949d..ef6d34c04 100644 --- a/cmd/commands/new/new.go +++ b/cmd/commands/new/new.go @@ -101,9 +101,9 @@ import ( ) func init() { - _, file, _, _ := runtime.Caller(1) - apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator)))) - beego.TestBeegoInit(apppath) + appPath, _ := filepath.Abs("..") + beego.TestBeegoInit(appPath) + beego.AppPath = appPath } diff --git a/test.txt b/test.txt new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test