Skip to content
This repository has been archived by the owner on Jan 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #69 from gartnera/wsl
Browse files Browse the repository at this point in the history
Add path to Chrome in Windows Subsystem for Linux
  • Loading branch information
ammario authored Apr 27, 2019
2 parents 7e5b44a + acf0057 commit d596609
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit d596609

Please sign in to comment.