Skip to content

Commit 75dd2cb

Browse files
unindenteddevelar
authored andcommitted
feat: custom NSIS installer icon (#969)
Close #964
1 parent 3b6af52 commit 75dd2cb

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

docs/Options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ See [NSIS target notes](https://github.com/electron-userland/electron-builder/wi
191191
| allowElevation | <a name="NsisOptions-allowElevation"></a>*boring installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions. Defaults to `true`.
192192
| runAfterFinish | <a name="NsisOptions-runAfterFinish"></a>*one-click installer only.* Run application after finish. Defaults to `true`.
193193
| guid | <a name="NsisOptions-guid"></a>See [GUID vs Application Name](https://github.com/electron-userland/electron-builder/wiki/NSIS#guid-vs-application-name).
194+
| installerIcon | <a name="NsisOptions-installerIcon"></a>The path to installer icon, relative to the project directory. Defaults to `build/installerIcon.ico` or application icon.
194195
| installerHeader | <a name="NsisOptions-installerHeader"></a>*boring installer only.* `MUI_HEADERIMAGE`, relative to the project directory. Defaults to `build/installerHeader.bmp`
195196
| installerHeaderIcon | <a name="NsisOptions-installerHeaderIcon"></a>*one-click installer only.* The path to header icon (above the progress bar), relative to the project directory. Defaults to `build/installerHeaderIcon.ico` or application icon.
196197
| include | <a name="NsisOptions-include"></a>The path to NSIS include script to customize installer. Defaults to `build/installer.nsh`. See [Custom NSIS script](https://github.com/electron-userland/electron-builder/wiki/NSIS#custom-nsis-script).

src/options/winOptions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ export interface NsisOptions {
9393
*/
9494
readonly guid?: string | null
9595

96+
/*
97+
The path to installer icon. Defaults to `build/installerIcon.ico` or application icon.
98+
*/
99+
readonly installerIcon?: string | null
100+
96101
/*
97102
*boring installer only.* `MUI_HEADERIMAGE`, relative to the project directory. Defaults to `build/installerHeader.bmp`
98103
*/

src/targets/nsis.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default class NsisTarget extends Target {
8585
const appInfo = packager.appInfo
8686
const version = appInfo.version
8787
const installerFilename = `${appInfo.productFilename} Setup ${version}.exe`
88-
const iconPath = await packager.getIconPath()
88+
const iconPath = await this.packager.getResource(this.options.installerIcon, "installerIcon.ico") || await this.packager.getIconPath()
8989

9090
const installerPath = path.join(this.outDir, installerFilename)
9191
const guid = this.options.guid || await BluebirdPromise.promisify(uuid5)({namespace: ELECTRON_BUILDER_NS_UUID, name: appInfo.id})

0 commit comments

Comments
 (0)