1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-03-19 21:28:32 +02:00

43 lines
675 B
Go
Raw Normal View History

2018-09-18 16:42:38 -04:00
package browser
import (
"os"
"os/exec"
"runtime"
)
func resolveExecutablePath() (path string) {
2018-09-18 16:42:38 -04:00
switch runtime.GOOS {
case goosDarwin:
2018-09-18 16:42:38 -04:00
for _, c := range []string{
"/Applications/Google Chrome Canary.app",
"/Applications/Google Chrome.app",
} {
// MacOS apps are actually folders
info, err := os.Stat(c)
if err == nil && info.IsDir() {
path = c
2018-09-18 16:42:38 -04:00
break
}
}
case goosLinux:
2018-09-18 16:42:38 -04:00
for _, c := range []string{
"headless_shell",
"chromium",
"google-chrome-beta",
"google-chrome-unstable",
"google-chrome-stable"} {
if _, err := exec.LookPath(c); err == nil {
path = c
2018-09-18 16:42:38 -04:00
break
}
}
case goosWindows:
2018-09-18 16:42:38 -04:00
}
return
2018-09-18 16:42:38 -04:00
}