MCPcopy
hub / github.com/httprunner/httprunner / locateExecutable

Function locateExecutable

hrp/plugin.go:157–170  ·  view source on GitHub ↗

locateExecutable finds destFile in hrp executable dir

(destFile string)

Source from the content-addressed store, hash-verified

155
156// locateExecutable finds destFile in hrp executable dir
157func locateExecutable(destFile string) (string, error) {
158 exePath, err := os.Executable()
159 if err != nil {
160 return "", errors.Wrap(err, "get hrp executable failed")
161 }
162
163 exeDir := filepath.Dir(exePath)
164 pluginPath := filepath.Join(exeDir, destFile)
165 if _, err := os.Stat(pluginPath); err == nil {
166 return pluginPath, nil
167 }
168
169 return "", errors.New("plugin file not found in hrp executable dir")
170}
171
172func GetProjectRootDirPath(path string) (rootDir string, err error) {
173 pluginPath, err := locatePlugin(path)

Callers 1

locateFileFunction · 0.85

Calls 1

StatMethod · 0.65

Tested by

no test coverage detected