fix shims for extensions on windows (#3009)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user