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