Skip to content

Commit f73ef85

Browse files
committed
fix(setup): resolve the docker app through LaunchServices, not fixed paths
A Homebrew `--appdir` can put OrbStack anywhere, so enumerating install directories will always have a tail that reads a present app as missing and sends setup to the wrong one. Fall back to LaunchServices when the well-known directories miss: that is the same lookup `open -a` performs, so availability now agrees with what the launch will actually do.
1 parent 844a667 commit f73ef85

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

scripts/setup/docker.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,18 @@ function orbstackSelected(): boolean {
4444
return result.status === 0 && result.stdout.trim() === 'orbstack'
4545
}
4646

47+
/**
48+
* Whether macOS can launch this app. The well-known directories cover every
49+
* normal install without spawning anything; LaunchServices is the authority
50+
* for the rest, since a Homebrew `--appdir` can put the bundle anywhere and
51+
* `open -a` would still find it there.
52+
*/
4753
function appInstalled(app: DockerApp): boolean {
48-
return APP_DIRS.some((dir) => existsSync(join(dir, app.bundle)))
54+
if (APP_DIRS.some((dir) => existsSync(join(dir, app.bundle)))) return true
55+
const lookup = spawnSync('osascript', ['-e', `path to application "${app.name}"`], {
56+
stdio: 'ignore',
57+
})
58+
return lookup.status === 0
4959
}
5060

5161
/**

0 commit comments

Comments
 (0)