coder / sshcode

Run VS Code on any server over SSH.

Repository from Github https://github.comcoder/sshcodeRepository from Github https://github.comcoder/sshcode

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

Merith-TK opened this issue · comments

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

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"