fix shims for extensions on windows (#3009)

This commit is contained in:
Max Novich
2025-06-19 15:45:41 -07:00
committed by GitHub
parent 16fdc2c965
commit 09a0079094
3 changed files with 129 additions and 8 deletions
+13 -8
View File
@@ -22,16 +22,21 @@ export const getBinaryPath = (app: Electron.App, binaryName: string): string =>
throw new Error(`Invalid binary name: ${binaryName}`);
}
const isWindows = process.platform === 'win32';
const possiblePaths: string[] = [];
if (isWindows) {
addPaths(isWindows, possiblePaths, `${binaryName}.exe`, app);
addPaths(isWindows, possiblePaths, `${binaryName}.cmd`, app);
} else {
addPaths(isWindows, possiblePaths, binaryName, app);
// On Windows, rely on PATH we just patched in ensureWinShims for command-line tools
// but use explicit resources/bin path for goosed.exe
if (process.platform === 'win32') {
// For goosed.exe, always use the explicit resources/bin path
if (binaryName === 'goosed') {
return path.join(process.resourcesPath, 'bin', 'goosed.exe');
}
// For other binaries (uvx, npx), rely on PATH we just patched
return binaryName;
}
// For non-Windows platforms, use the original logic
const possiblePaths: string[] = [];
addPaths(false, possiblePaths, binaryName, app);
for (const binPath of possiblePaths) {
try {
// Security: Resolve the path and validate it's within expected directories