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

Commit acf0057

Browse files
Alex Gartnergartnera
Alex Gartner
authored andcommitted
Add path to Chrome in Windows Subsystem for Linux
1 parent 7e5b44a commit acf0057

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

main.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,12 @@ chmod +x ` + codeServerPath
225225

226226
func openBrowser(url string) {
227227
var openCmd *exec.Cmd
228+
229+
const (
230+
macPath = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
231+
wslPath = "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"
232+
)
233+
228234
switch {
229235
case commandExists("google-chrome"):
230236
openCmd = exec.Command("google-chrome", chromeOptions(url)...)
@@ -234,8 +240,10 @@ func openBrowser(url string) {
234240
openCmd = exec.Command("chromium", chromeOptions(url)...)
235241
case commandExists("chromium-browser"):
236242
openCmd = exec.Command("chromium-browser", chromeOptions(url)...)
237-
case pathExists("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"):
238-
openCmd = exec.Command("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", chromeOptions(url)...)
243+
case pathExists(macPath):
244+
openCmd = exec.Command(macPath, chromeOptions(url)...)
245+
case pathExists(wslPath):
246+
openCmd = exec.Command(wslPath, chromeOptions(url)...)
239247
default:
240248
err := browser.OpenURL(url)
241249
if err != nil {

0 commit comments

Comments
 (0)