Skip to content

Commit

Permalink
Always resolve symlink when using os.Executable
Browse files Browse the repository at this point in the history
When running /usr/local/bin/crc, the bundle could not be found because the
symlink was not evaluated.
  • Loading branch information
guillaumerose committed Sep 7, 2021
1 parent 1f746f4 commit 23784b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/crc/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ func InstallPath() string {
logging.Errorf("Failed to find the installation path: %v", err)
return ""
}
return filepath.Dir(currentExecutablePath)
src, err := filepath.EvalSymlinks(currentExecutablePath)
if err != nil {
logging.Errorf("Failed to find the symlink destination of %s: %v", currentExecutablePath, err)
return filepath.Dir(currentExecutablePath)
}
return filepath.Dir(src)
}

func GetCRCLatestVersionFromMirror(transport http.RoundTripper) (*CrcReleaseInfo, error) {
Expand Down

0 comments on commit 23784b9

Please sign in to comment.