mirror of
https://github.com/aljazceru/goose.git
synced 2026-02-20 14:04:32 +01:00
fix windows native uvx (#1775)
This commit is contained in:
@@ -8,39 +8,38 @@ export const getBinaryPath = (app: Electron.App, binaryName: string): string =>
|
||||
const isPackaged = app.isPackaged;
|
||||
const isWindows = process.platform === 'win32';
|
||||
|
||||
// On Windows, use .cmd for npx and .exe for uvx
|
||||
const executableName = isWindows
|
||||
? binaryName === 'npx'
|
||||
? 'npx.cmd'
|
||||
: `${binaryName}.exe`
|
||||
: binaryName;
|
||||
|
||||
// List of possible paths to check
|
||||
const possiblePaths = [];
|
||||
|
||||
if (isDev && !isPackaged) {
|
||||
// In development, check multiple possible locations
|
||||
possiblePaths.push(
|
||||
path.join(process.cwd(), 'src', 'bin', executableName),
|
||||
path.join(process.cwd(), 'bin', executableName),
|
||||
path.join(process.cwd(), '..', '..', 'target', 'release', executableName)
|
||||
);
|
||||
} else {
|
||||
// In production, check resources paths
|
||||
possiblePaths.push(
|
||||
path.join(process.resourcesPath, 'bin', executableName),
|
||||
path.join(app.getAppPath(), 'resources', 'bin', executableName)
|
||||
);
|
||||
|
||||
if (isWindows) {
|
||||
possiblePaths.push(
|
||||
path.join(process.resourcesPath, executableName),
|
||||
path.join(app.getAppPath(), 'resources', executableName),
|
||||
path.join(app.getPath('exe'), '..', 'bin', executableName)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Log all paths we're checking
|
||||
log.info('Checking binary paths:', possiblePaths);
|
||||
|
||||
// Try each path and return the first one that exists
|
||||
for (const binPath of possiblePaths) {
|
||||
try {
|
||||
if (fs.existsSync(binPath)) {
|
||||
log.info(`Found binary at: ${binPath}`);
|
||||
return binPath;
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -48,8 +47,7 @@ export const getBinaryPath = (app: Electron.App, binaryName: string): string =>
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we couldn't find the binary
|
||||
const error = `Could not find ${binaryName} binary in any of the expected locations: ${possiblePaths.join(', ')}`;
|
||||
log.error(error);
|
||||
throw new Error(error);
|
||||
throw new Error(
|
||||
`Could not find ${binaryName} binary in any of the expected locations: ${possiblePaths.join(', ')}`
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user