Fix IPC proxy selection in prod when using ELECTRON_IS_DEV (#11412)

This commit is contained in:
Daniel García 2024-10-07 10:38:41 +02:00 committed by GitHub
parent bdf91e24c6
commit e1d46045e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -331,7 +331,7 @@ export class NativeMessagingMain {
const ext = process.platform === "win32" ? ".exe" : ""; const ext = process.platform === "win32" ? ".exe" : "";
if (isDev()) { if (isDev()) {
return path.join( const devPath = path.join(
this.appPath, this.appPath,
"..", "..",
"desktop_native", "desktop_native",
@ -339,6 +339,12 @@ export class NativeMessagingMain {
"debug", "debug",
`desktop_proxy${ext}`, `desktop_proxy${ext}`,
); );
// isDev() returns true when using a production build with ELECTRON_IS_DEV=1,
// so we need to fall back to the prod binary if the dev binary doesn't exist.
if (existsSync(devPath)) {
return devPath;
}
} }
return path.join(path.dirname(this.exePath), `desktop_proxy${ext}`); return path.join(path.dirname(this.exePath), `desktop_proxy${ext}`);