Skip to content

Commit 3b3a698

Browse files
authoredNov 27, 2023
fix: use product name for helper apps (#7900)
Fixes #6962.
1 parent 65817e0 commit 3b3a698

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
 

‎.changeset/warm-pets-double.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
fix macOS app with exectuableName different from productName

‎packages/app-builder-lib/src/electron/electronMac.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ function getAvailableHelperSuffixes(
5050
/** @internal */
5151
export async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {
5252
const appInfo = packager.appInfo
53-
const appFilename = appInfo.productFilename
53+
// Electon uses the application name (CFBundleName) to resolve helper apps
54+
// https://github.com/electron/electron/blob/main/shell/app/electron_main_delegate_mac.mm
55+
// https://github.com/electron-userland/electron-builder/issues/6962
56+
const appFilename = appInfo.sanitizedProductName
5457
const electronBranding = createBrandingOpts(packager.config)
5558

5659
const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, "Contents")
@@ -270,7 +273,7 @@ export async function createMacApp(packager: MacPackager, appOutDir: string, asa
270273
await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix).then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))
271274
}
272275

273-
const appPath = path.join(appOutDir, `${appFilename}.app`)
276+
const appPath = path.join(appOutDir, `${appInfo.productFilename}.app`)
274277
await rename(path.dirname(contentsPath), appPath)
275278
// https://github.com/electron-userland/electron-builder/issues/840
276279
const now = Date.now() / 1000

0 commit comments

Comments
 (0)
Please sign in to comment.