MCPcopy Index your code
hub / github.com/jetify-com/devbox / resolveEditorBinary

Function resolveEditorBinary

internal/boxcli/integrate.go:148–158  ·  view source on GitHub ↗

resolveEditorBinary returns the path to the editor binary. On WSL, VSCODE_CWD points to the VS Code installation directory, so we can construct an absolute path to avoid the VS Code Server shell script. On macOS, VSCODE_CWD is the workspace directory, so the constructed path won't exist and we fall

(ideName string)

Source from the content-addressed store, hash-verified

146// On macOS, VSCODE_CWD is the workspace directory, so the constructed
147// path won't exist and we fall back to the bare command name.
148func resolveEditorBinary(ideName string) string {
149 cwd, ok := os.LookupEnv("VSCODE_CWD")
150 if !ok {
151 return ideName
152 }
153 fullPath := cwd + "/bin/" + ideName
154 if _, err := os.Stat(fullPath); err == nil {
155 return fullPath
156 }
157 return ideName
158}
159
160type debugMode struct {
161 enabled bool

Callers 2

TestResolveEditorBinaryFunction · 0.85
runIntegrateVSCodeCmdFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestResolveEditorBinaryFunction · 0.68