Skip to content

Commit

Permalink
Merge pull request #17027 from n8henrie/issue_17026
Browse files Browse the repository at this point in the history
Resolve symlink path for qemu directory if possible
  • Loading branch information
openshift-merge-robot authored Feb 8, 2023
2 parents c5f83f2 + 6b64589 commit c5bfacd
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions pkg/machine/qemu/options_darwin_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ func getOvmfDir(imagePath, vmName string) string {
*/
func getEdk2CodeFdPathFromQemuBinaryPath() string {
cfg, err := config.Default()
if err == nil {
execPath, err := cfg.FindHelperBinary(QemuCommand, true)
if err == nil {
return filepath.Clean(filepath.Join(filepath.Dir(execPath), "..", "share", "qemu"))
}
if err != nil {
return ""
}
execPath, err := cfg.FindHelperBinary(QemuCommand, true)
if err != nil {
return ""
}

sharePath := func(path string) string {
return filepath.Clean(filepath.Join(filepath.Dir(path), "..", "share", "qemu"))
}

symlinkedPath, err := filepath.EvalSymlinks(execPath)
if err != nil {
return sharePath(execPath)
}
return ""
return sharePath(symlinkedPath)
}

/*
Expand Down

0 comments on commit c5bfacd

Please sign in to comment.