From fce1a1fab66e3f5cd741a4cecc4af8377aea9dd8 Mon Sep 17 00:00:00 2001 From: Sebastian Rettig Date: Mon, 4 Oct 2021 00:10:04 +0200 Subject: [PATCH] fix(app-builder-lib): macOS packager uses static icon name (#6308) --- .changeset/dirty-walls-burn.md | 5 + packages/app-builder-lib/src/macPackager.ts | 2 +- test/snapshots/PublishManagerTest.js.snap | 6 +- test/snapshots/mac/dmgTest.js.snap | 28 ++-- test/snapshots/mac/macArchiveTest.js.snap | 16 +-- test/snapshots/mac/macPackagerTest.js.snap | 12 +- test/snapshots/protonTest.js.snap | 2 +- .../windows/assistedInstallerTest.js.snap | 130 ------------------ 8 files changed, 38 insertions(+), 163 deletions(-) create mode 100644 .changeset/dirty-walls-burn.md delete mode 100644 test/snapshots/windows/assistedInstallerTest.js.snap diff --git a/.changeset/dirty-walls-burn.md b/.changeset/dirty-walls-burn.md new file mode 100644 index 0000000000..82c69731dc --- /dev/null +++ b/.changeset/dirty-walls-burn.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +The filename of the app icon in macOS is now always 'icon.icns' instead of a derivate of the product name. The reason for this change is that macOS doesn't display icons with non-ASCII characters in their names, which is quite possible in languages other than English. diff --git a/packages/app-builder-lib/src/macPackager.ts b/packages/app-builder-lib/src/macPackager.ts index 9b373bd388..2f755c13b7 100644 --- a/packages/app-builder-lib/src/macPackager.ts +++ b/packages/app-builder-lib/src/macPackager.ts @@ -396,7 +396,7 @@ export default class MacPackager extends PlatformPackager { if (oldIcon != null) { await unlinkIfExists(path.join(resourcesPath, oldIcon)) } - const iconFileName = `${appFilename}.icns` + const iconFileName = "icon.icns" appPlist.CFBundleIconFile = iconFileName await copyFile(icon, path.join(resourcesPath, iconFileName)) } diff --git a/test/snapshots/PublishManagerTest.js.snap b/test/snapshots/PublishManagerTest.js.snap index 2196156e69..1692f5ec33 100644 --- a/test/snapshots/PublishManagerTest.js.snap +++ b/test/snapshots/PublishManagerTest.js.snap @@ -162,7 +162,7 @@ exports[`generic, github and spaces 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -289,7 +289,7 @@ exports[`mac artifactName 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -366,7 +366,7 @@ exports[`os macro 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", diff --git a/test/snapshots/mac/dmgTest.js.snap b/test/snapshots/mac/dmgTest.js.snap index 25b8db67c6..d8ca2c121e 100644 --- a/test/snapshots/mac/dmgTest.js.snap +++ b/test/snapshots/mac/dmgTest.js.snap @@ -35,7 +35,7 @@ exports[`background color 3`] = ` Object { "CFBundleDisplayName": "BackgroundColor", "CFBundleExecutable": "BackgroundColor", - "CFBundleIconFile": "BackgroundColor.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "BackgroundColor", @@ -94,7 +94,7 @@ exports[`bundleShortVersion 2`] = ` Object { "CFBundleDisplayName": "BundleShortVersion", "CFBundleExecutable": "BundleShortVersion", - "CFBundleIconFile": "BundleShortVersion.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "BundleShortVersion", @@ -148,7 +148,7 @@ exports[`custom background - new way 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -202,7 +202,7 @@ exports[`disable dmg icon (light), bundleVersion 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -261,7 +261,7 @@ exports[`dmg 2`] = ` Object { "CFBundleDisplayName": "DefaultDmg", "CFBundleExecutable": "DefaultDmg", - "CFBundleIconFile": "DefaultDmg.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "DefaultDmg", @@ -380,7 +380,7 @@ exports[`license buttons config 3`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -441,7 +441,7 @@ exports[`license en 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -502,7 +502,7 @@ exports[`license ja 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -563,7 +563,7 @@ exports[`license rtf 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -624,7 +624,7 @@ exports[`multi language license 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -707,7 +707,7 @@ exports[`no Applications link 3`] = ` Object { "CFBundleDisplayName": "NoApplicationsLink", "CFBundleExecutable": "NoApplicationsLink", - "CFBundleIconFile": "NoApplicationsLink.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "NoApplicationsLink", @@ -766,7 +766,7 @@ exports[`no background 2`] = ` Object { "CFBundleDisplayName": "NoBackground", "CFBundleExecutable": "NoBackground", - "CFBundleIconFile": "NoBackground.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "NoBackground", @@ -894,7 +894,7 @@ exports[`retina background as 2 png 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -955,7 +955,7 @@ exports[`unset dmg icon 2`] = ` Object { "CFBundleDisplayName": "Test ß No Volume Icon", "CFBundleExecutable": "Test ß No Volume Icon", - "CFBundleIconFile": "Test ß No Volume Icon.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test ß No Volume Icon", diff --git a/test/snapshots/mac/macArchiveTest.js.snap b/test/snapshots/mac/macArchiveTest.js.snap index 214bec861f..f3c66d84a4 100644 --- a/test/snapshots/mac/macArchiveTest.js.snap +++ b/test/snapshots/mac/macArchiveTest.js.snap @@ -16,7 +16,7 @@ exports[`empty installLocation 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -77,7 +77,7 @@ exports[`extraDistFiles 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -159,7 +159,7 @@ exports[`only zip 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -208,7 +208,7 @@ exports[`pkg 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -257,7 +257,7 @@ exports[`pkg extended configuration 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -306,7 +306,7 @@ exports[`pkg scripts 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", @@ -405,7 +405,7 @@ Array [ "Test App ßW.app/Contents/Resources/sw.lproj", "Test App ßW.app/Contents/Resources/ta.lproj", "Test App ßW.app/Contents/Resources/te.lproj", - "Test App ßW.app/Contents/Resources/Test App ßW.icns", + "Test App ßW.app/Contents/Resources/icon.icns", "Test App ßW.app/Contents/Resources/th.lproj", "Test App ßW.app/Contents/Resources/tr.lproj", "Test App ßW.app/Contents/Resources/uk.lproj", @@ -791,7 +791,7 @@ exports[`tar.gz 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "Test App ßW", diff --git a/test/snapshots/mac/macPackagerTest.js.snap b/test/snapshots/mac/macPackagerTest.js.snap index aa8e96d759..741b48f2a9 100644 --- a/test/snapshots/mac/macPackagerTest.js.snap +++ b/test/snapshots/mac/macPackagerTest.js.snap @@ -254,7 +254,7 @@ exports[`two-package 2`] = ` Object { "CFBundleDisplayName": "TestApp", "CFBundleExecutable": "TestApp", - "CFBundleIconFile": "TestApp.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "TestApp", @@ -289,7 +289,7 @@ Object { exports[`two-package 3`] = ` Array [ - "TestApp.icns", + "icon.icns", "app-update.yml", "app.asar", "bn.lproj", @@ -301,7 +301,7 @@ exports[`two-package 4`] = ` Object { "CFBundleDisplayName": "TestApp", "CFBundleExecutable": "TestApp", - "CFBundleIconFile": "TestApp.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "TestApp", @@ -336,7 +336,7 @@ Object { exports[`two-package 5`] = ` Array [ - "TestApp.icns", + "icon.icns", "app-update.yml", "app.asar", "bn.lproj", @@ -348,7 +348,7 @@ exports[`two-package 6`] = ` Object { "CFBundleDisplayName": "TestApp", "CFBundleExecutable": "TestApp", - "CFBundleIconFile": "TestApp.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleInfoDictionaryVersion": "6.0", "CFBundleName": "TestApp", @@ -383,7 +383,7 @@ Object { exports[`two-package 7`] = ` Array [ - "TestApp.icns", + "icon.icns", "app-update.yml", "app.asar", "bn.lproj", diff --git a/test/snapshots/protonTest.js.snap b/test/snapshots/protonTest.js.snap index 97e5474914..d7f816d586 100644 --- a/test/snapshots/protonTest.js.snap +++ b/test/snapshots/protonTest.js.snap @@ -45,7 +45,7 @@ exports[`mac 2`] = ` Object { "CFBundleDisplayName": "Test App ßW", "CFBundleExecutable": "Test App ßW", - "CFBundleIconFile": "Test App ßW.icns", + "CFBundleIconFile": "icon.icns", "CFBundleIdentifier": "org.electron-builder.testApp", "CFBundleName": "Test App ßW", "CFBundleShortVersionString": "1.1.0", diff --git a/test/snapshots/windows/assistedInstallerTest.js.snap b/test/snapshots/windows/assistedInstallerTest.js.snap deleted file mode 100644 index 7fbe86534f..0000000000 --- a/test/snapshots/windows/assistedInstallerTest.js.snap +++ /dev/null @@ -1,130 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`allowElevation false, app requestedExecutionLevel admin 1`] = ` -Object { - "win": Array [ - Object { - "arch": "x64", - "file": "test Setup 1.1.0.exe", - "safeArtifactName": "test-Setup-1.1.0.exe", - }, - ], -} -`; - -exports[`allowToChangeInstallationDirectory 1`] = ` -Object { - "win": Array [ - Object { - "file": "latest.yml", - "fileContent": Object { - "files": Array [ - Object { - "sha512": "@sha512", - "size": "@size", - "url": "Test-Custom-Installation-Dir-Setup-1.1.0.exe", - }, - ], - "path": "Test-Custom-Installation-Dir-Setup-1.1.0.exe", - "releaseDate": "@releaseDate", - "releaseNotes": "New release with new bugs and - -without features", - "sha512": "@sha512", - "version": "1.1.0", - }, - }, - Object { - "arch": "x64", - "file": "Test Custom Installation Dir Setup 1.1.0.exe", - "safeArtifactName": "Test-Custom-Installation-Dir-Setup-1.1.0.exe", - "updateInfo": Object { - "sha512": "@sha512", - "size": "@size", - }, - }, - Object { - "file": "Test Custom Installation Dir Setup 1.1.0.exe.blockmap", - "safeArtifactName": "Test-Custom-Installation-Dir-Setup-1.1.0.exe.blockmap", - "updateInfo": Object { - "sha512": "@sha512", - "size": "@size", - }, - }, - ], -} -`; - -exports[`allowToChangeInstallationDirectory 2`] = ` -Object { - "owner": "foo", - "provider": "github", - "repo": "bar", - "updaterCacheDirName": "test-custom-inst-dir-updater", -} -`; - -exports[`assisted 1`] = ` -Object { - "win": Array [ - Object { - "arch": "x64", - "file": "Test App ßW Setup 1.1.0.exe", - "safeArtifactName": "TestApp-Setup-1.1.0.exe", - "updateInfo": Object { - "sha512": "@sha512", - "size": "@size", - }, - }, - Object { - "file": "Test App ßW Setup 1.1.0.exe.blockmap", - "safeArtifactName": "TestApp-Setup-1.1.0.exe.blockmap", - "updateInfo": Object { - "sha512": "@sha512", - "size": "@size", - }, - }, - ], -} -`; - -exports[`assisted, MUI_HEADER 1`] = ` -Object { - "win": Array [], -} -`; - -exports[`assisted, MUI_HEADER as option 1`] = ` -Object { - "win": Array [ - Object { - "file": "Test App ßW Setup 1.1.0.exe", - "safeArtifactName": "TestApp-Setup-1.1.0.exe", - }, - ], -} -`; - -exports[`assisted, only perMachine 1`] = ` -Object { - "win": Array [ - Object { - "arch": "x64", - "file": "Test App ßW Setup 1.1.0.exe", - "safeArtifactName": "TestApp-Setup-1.1.0.exe", - "updateInfo": Object { - "sha512": "@sha512", - "size": "@size", - }, - }, - Object { - "file": "Test App ßW Setup 1.1.0.exe.blockmap", - "safeArtifactName": "TestApp-Setup-1.1.0.exe.blockmap", - "updateInfo": Object { - "sha512": "@sha512", - "size": "@size", - }, - }, - ], -} -`;