Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ chmod +x ` + codeServerPath

func openBrowser(url string) {
var openCmd *exec.Cmd

const (
macPath = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
wslPath = "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"
)

switch {
case commandExists("google-chrome"):
openCmd = exec.Command("google-chrome", chromeOptions(url)...)
Expand All @@ -234,8 +240,10 @@ func openBrowser(url string) {
openCmd = exec.Command("chromium", chromeOptions(url)...)
case commandExists("chromium-browser"):
openCmd = exec.Command("chromium-browser", chromeOptions(url)...)
case pathExists("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"):
openCmd = exec.Command("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", chromeOptions(url)...)
case pathExists(macPath):
openCmd = exec.Command(macPath, chromeOptions(url)...)
case pathExists(wslPath):
openCmd = exec.Command(wslPath, chromeOptions(url)...)
default:
err := browser.OpenURL(url)
if err != nil {
Expand Down