mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-16 11:37:36 +02:00
de703513e4
* linter cleanup * fix default case
43 lines
675 B
Go
43 lines
675 B
Go
package browser
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"runtime"
|
|
)
|
|
|
|
func resolveExecutablePath() (path string) {
|
|
|
|
switch runtime.GOOS {
|
|
case goosDarwin:
|
|
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
|
|
break
|
|
}
|
|
}
|
|
|
|
case goosLinux:
|
|
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
|
|
break
|
|
}
|
|
}
|
|
|
|
case goosWindows:
|
|
}
|
|
|
|
return
|
|
}
|