locateExecutable finds destFile in hrp executable dir
(destFile string)
| 155 | |
| 156 | // locateExecutable finds destFile in hrp executable dir |
| 157 | func 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 | |
| 172 | func GetProjectRootDirPath(path string) (rootDir string, err error) { |
| 173 | pluginPath, err := locatePlugin(path) |