mirror of https://github.com/perkeep/perkeep.git
Help devcam find itself correctly on OS X
This implements osutil.SelfPath on darwin by trying a $PATH lookup using the command invocation name. Stops the nagging "couldn't stat devcam binary" message on OS X. Change-Id: I42c7f5c30148d810ca753e0812b772db24e93356
This commit is contained in:
parent
0ba58ae829
commit
20470f544f
|
@ -23,6 +23,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
@ -50,7 +51,7 @@ func SelfPath() (string, error) {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
// TODO(mpl): maybe do the right thing for darwin too, but that may require changes to runtime.
|
// TODO(mpl): maybe do the right thing for darwin too, but that may require changes to runtime.
|
||||||
// See https://codereview.appspot.com/6736069/
|
// See https://codereview.appspot.com/6736069/
|
||||||
return os.Args[0], nil
|
return exec.LookPath(os.Args[0])
|
||||||
}
|
}
|
||||||
return "", errors.New("SelfPath not implemented for " + runtime.GOOS)
|
return "", errors.New("SelfPath not implemented for " + runtime.GOOS)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue