From e1d46045e0d62456378df3e6a9cc0d7f6d82f761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Mon, 7 Oct 2024 10:38:41 +0200 Subject: [PATCH] Fix IPC proxy selection in prod when using ELECTRON_IS_DEV (#11412) --- apps/desktop/src/main/native-messaging.main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/main/native-messaging.main.ts b/apps/desktop/src/main/native-messaging.main.ts index ec57ecdf7b..9c9f1ae6a9 100644 --- a/apps/desktop/src/main/native-messaging.main.ts +++ b/apps/desktop/src/main/native-messaging.main.ts @@ -331,7 +331,7 @@ export class NativeMessagingMain { const ext = process.platform === "win32" ? ".exe" : ""; if (isDev()) { - return path.join( + const devPath = path.join( this.appPath, "..", "desktop_native", @@ -339,6 +339,12 @@ export class NativeMessagingMain { "debug", `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}`);