Skip to content

Commit 3a1042a

Browse files
committed
fix(mac): dist app quit unexpectedly caused by productName
Close #1278
1 parent 3f3419a commit 3a1042a

File tree

1 file changed

+12
-10
lines changed
  • packages/electron-builder/src/packager

1 file changed

+12
-10
lines changed

packages/electron-builder/src/packager/mac.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,27 @@ export async function createApp(packager: PlatformPackager<any>, appOutDir: stri
6666
const icon = await packager.getIconPath()
6767
const oldIcon = appPlist.CFBundleIconFile
6868
if (icon != null) {
69-
appPlist.CFBundleIconFile = `${appInfo.productFilename}.icns`
69+
appPlist.CFBundleIconFile = `${appFilename}.icns`
7070
}
7171

7272
appPlist.CFBundleDisplayName = appInfo.productName
7373
appPlist.CFBundleIdentifier = appBundleIdentifier
7474
appPlist.CFBundleName = appInfo.productName
75-
helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`
76-
helperPlist.CFBundleIdentifier = helperBundleIdentifier
77-
appPlist.CFBundleExecutable = appFilename
78-
helperPlist.CFBundleName = appInfo.productName
75+
76+
// https://github.com/electron-userland/electron-builder/issues/1278
77+
appPlist.CFBundleExecutable = !appFilename.endsWith(" Helper") ? appFilename : appFilename.substring(0, appFilename.length - " Helper".length)
78+
7979
helperPlist.CFBundleExecutable = `${appFilename} Helper`
80-
helperEHPlist.CFBundleDisplayName = `${appFilename} Helper EH`
81-
helperEHPlist.CFBundleIdentifier = `${helperBundleIdentifier}.EH`
82-
helperEHPlist.CFBundleName = `${appInfo.productName} Helper EH`
8380
helperEHPlist.CFBundleExecutable = `${appFilename} Helper EH`
81+
helperNPPlist.CFBundleExecutable = `${appFilename} Helper NP`
82+
83+
helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`
84+
helperEHPlist.CFBundleDisplayName = `${appInfo.productName} Helper EH`
8485
helperNPPlist.CFBundleDisplayName = `${appInfo.productName} Helper NP`
86+
87+
helperPlist.CFBundleIdentifier = helperBundleIdentifier
88+
helperEHPlist.CFBundleIdentifier = `${helperBundleIdentifier}.EH`
8589
helperNPPlist.CFBundleIdentifier = `${helperBundleIdentifier}.NP`
86-
helperNPPlist.CFBundleName = `${appInfo.productName} Helper NP`
87-
helperNPPlist.CFBundleExecutable = `${appFilename} Helper NP`
8890

8991
appPlist.CFBundleShortVersionString = appInfo.version
9092
appPlist.CFBundleVersion = appInfo.buildVersion

0 commit comments

Comments
 (0)