Skip to content

Commit bf46393

Browse files
revert: keep macOS vscode searchLocations on the .app bundle
Previous commit 9c97b72 pointed searchLocations at <bundle>/Contents/Resources/app/bin/code, but tool_darwin.go's generateCommandLine launches via 'open -a <path> --args ...', which only accepts registered app names or .app bundle paths. With the changed location, open -a fails with 'Unable to find application'. file.Exists already accepts directories, so the original .app path was correct end-to-end. Restore it and keep the additional \C:\Users\DLevy/Applications probe.
1 parent 66e4ab5 commit bf46393

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

internal/tools/tool/vscode_darwin.go

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,26 @@ package tool
55

66
import (
77
"os"
8-
"os/exec"
98
"path/filepath"
109
)
1110

11+
// searchLocations returns the .app bundle paths to probe. tool_darwin.go's
12+
// generateCommandLine launches via "open -a <path> --args ...", which expects
13+
// either a registered app name or a .app bundle path; pointing it at the
14+
// in-bundle code binary would fail with "Unable to find application".
1215
func (t *VSCode) searchLocations() []string {
1316
userProfile := os.Getenv("HOME")
1417

15-
// The .app bundle is a directory; the launchable binary lives at
16-
// Contents/Resources/app/bin/<cli>. Prefer the PATH shim the user
17-
// installs via "Shell Command: Install 'code' command in PATH", then
18-
// fall back to the in-bundle binary at the standard install locations.
1918
var locations []string
2019
for _, build := range t.buildsToSearch() {
21-
cli := "code"
2220
app := "Visual Studio Code.app"
2321
if build == "insiders" {
24-
cli = "code-insiders"
2522
app = "Visual Studio Code - Insiders.app"
2623
}
27-
if p, err := exec.LookPath(cli); err == nil {
28-
locations = append(locations, p)
29-
}
30-
binPath := filepath.Join("Contents", "Resources", "app", "bin", cli)
3124
locations = append(locations,
32-
filepath.Join("/", "Applications", app, binPath),
33-
filepath.Join(userProfile, "Applications", app, binPath),
34-
filepath.Join(userProfile, "Downloads", app, binPath),
25+
filepath.Join("/", "Applications", app),
26+
filepath.Join(userProfile, "Applications", app),
27+
filepath.Join(userProfile, "Downloads", app),
3528
)
3629
}
3730
return locations

0 commit comments

Comments
 (0)