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

Windows WSL/MSYS path issues (fixes pr#127) #129

Closed
Merith-TK opened this issue Jul 30, 2019 · 1 comment
Closed

Windows WSL/MSYS path issues (fixes pr#127) #129

Merith-TK opened this issue Jul 30, 2019 · 1 comment

Comments

@Merith-TK
Copy link
Contributor

Merith-TK commented Jul 30, 2019

I have narrowed down my error for to specifcally this
msysPath = "/c/'Program Files (x86)'/Google/Chrome/Application/chrome.exe"
(x86)
It seems to thing that it is trying to leave exec.Command() by using the ) from (x86)

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"
        msysPath = "/c/'Program Files (x86)'/Google/Chrome/Application/chrome.exe"
    )

    switch {
    case commandExists("google-chrome"):
        openCmd = exec.Command("google-chrome", chromeOptions(url)...)
    case commandExists("google-chrome-stable"):
        openCmd = exec.Command("google-chrome-stable", chromeOptions(url)...)
    case commandExists("chromium"):
        openCmd = exec.Command("chromium", chromeOptions(url)...)
    case commandExists("chromium-browser"):
        openCmd = exec.Command("chromium-browser", chromeOptions(url)...)
    case pathExists(macPath):
        openCmd = exec.Command(macPath, chromeOptions(url)...)
    case pathExists(wslPath):
        openCmd = exec.Command(wslPath, chromeOptions(url)...)
    case pathExists(msysPath):
        openCmd = exec.Command(msysPath, chromeOptions(url)...)
    default:
        err := browser.OpenURL(url)
        if err != nil {
            flog.Error("failed to open browser: %v", err)
        }
        return
    }
}

the most annoying thing is, I KNOW THE DAMNED ERROR, I dont know how to fracking FIX IT!
THis is what is holding back #127 from being pushed to mainstream

@Merith-TK
Copy link
Contributor Author

Found out the error,
/c/ would work if it was WSL using that as it would use the Linux Go Runtime,
i was working with the WINDOWS GO runtime so i had to change the path to
msysPath = "/Program Files (x86)/Google/Chrome/Application/chrome.exe"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant