mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix: failed to locate root dir even if proj.json exist
This commit is contained in:
@@ -17,6 +17,7 @@ const (
|
|||||||
goPluginFile = "debugtalk.so" // built from go plugin
|
goPluginFile = "debugtalk.so" // built from go plugin
|
||||||
hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin
|
hashicorpGoPluginFile = "debugtalk.bin" // built from hashicorp go plugin
|
||||||
hashicorpPyPluginFile = "debugtalk.py" // used for hashicorp python plugin
|
hashicorpPyPluginFile = "debugtalk.py" // used for hashicorp python plugin
|
||||||
|
projectInfoFile = "proj.json" // used for ensuring root project
|
||||||
)
|
)
|
||||||
|
|
||||||
func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, pluginDir string, err error) {
|
func initPlugin(path string, logOn bool) (plugin funplugin.IPlugin, pluginDir string, err error) {
|
||||||
@@ -118,9 +119,15 @@ func GetProjectRootDirPath(path string) (rootDir string, err error) {
|
|||||||
rootDir = filepath.Dir(pluginPath)
|
rootDir = filepath.Dir(pluginPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// fix: no debugtalk file in project but having proj.json created by startpeoject
|
||||||
|
projPath, err := locateFile(path, projectInfoFile)
|
||||||
|
if err == nil {
|
||||||
|
rootDir = filepath.Dir(projPath)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// failed to locate project root dir
|
// failed to locate project root dir
|
||||||
// maybe project plugin debugtalk.xx is not exist
|
// maybe project plugin debugtalk.xx and proj.json are not exist
|
||||||
// use current dir instead
|
// use current dir instead
|
||||||
return os.Getwd()
|
return os.Getwd()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user