Skip to content

Commit

Permalink
fix: use product name for helper apps (#7900)
Browse files Browse the repository at this point in the history
Fixes #6962.
  • Loading branch information
jebibot committed Nov 27, 2023
1 parent 65817e0 commit 3b3a698
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-pets-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix macOS app with exectuableName different from productName
7 changes: 5 additions & 2 deletions packages/app-builder-lib/src/electron/electronMac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ function getAvailableHelperSuffixes(
/** @internal */
export async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {
const appInfo = packager.appInfo
const appFilename = appInfo.productFilename
// Electon uses the application name (CFBundleName) to resolve helper apps
// https://github.com/electron/electron/blob/main/shell/app/electron_main_delegate_mac.mm
// https://github.com/electron-userland/electron-builder/issues/6962
const appFilename = appInfo.sanitizedProductName
const electronBranding = createBrandingOpts(packager.config)

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

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

0 comments on commit 3b3a698

Please sign in to comment.