refactor: restructure code

This commit is contained in:
debugtalk
2022-03-29 11:38:58 +08:00
parent 95947987ef
commit b3610e550b
28 changed files with 2482 additions and 2384 deletions

View File

@@ -115,3 +115,16 @@ func locateFile(startPath string, destFile string) (string, error) {
return locateFile(parentDir, destFile)
}
func getProjectRootDirPath(path string) (rootDir string, err error) {
pluginPath, err := locatePlugin(path)
if err == nil {
rootDir = filepath.Dir(pluginPath)
return
}
// failed to locate project root dir
// maybe project plugin debugtalk.xx is not exist
// use current dir instead
return os.Getwd()
}