From 75dd2cb15db23e1aef9eaaa366d582b5a0c7ee36 Mon Sep 17 00:00:00 2001 From: Daniel Perez Alvarez Date: Sat, 3 Dec 2016 11:45:46 +0000 Subject: [PATCH] feat: custom NSIS installer icon (#969) Close #964 --- docs/Options.md | 1 + src/options/winOptions.ts | 5 +++++ src/targets/nsis.ts | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/Options.md b/docs/Options.md index 9b62d1e9e39..a3a2c7b574a 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -191,6 +191,7 @@ See [NSIS target notes](https://github.com/electron-userland/electron-builder/wi | allowElevation | *boring installer only.* Allow requesting for elevation. If false, user will have to restart installer with elevated permissions. Defaults to `true`. | runAfterFinish | *one-click installer only.* Run application after finish. Defaults to `true`. | guid | See [GUID vs Application Name](https://github.com/electron-userland/electron-builder/wiki/NSIS#guid-vs-application-name). +| installerIcon | The path to installer icon, relative to the project directory. Defaults to `build/installerIcon.ico` or application icon. | installerHeader | *boring installer only.* `MUI_HEADERIMAGE`, relative to the project directory. Defaults to `build/installerHeader.bmp` | installerHeaderIcon | *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. | include | 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). diff --git a/src/options/winOptions.ts b/src/options/winOptions.ts index da1b34d1f76..93879e896bb 100644 --- a/src/options/winOptions.ts +++ b/src/options/winOptions.ts @@ -93,6 +93,11 @@ export interface NsisOptions { */ readonly guid?: string | null + /* + The path to installer icon. Defaults to `build/installerIcon.ico` or application icon. + */ + readonly installerIcon?: string | null + /* *boring installer only.* `MUI_HEADERIMAGE`, relative to the project directory. Defaults to `build/installerHeader.bmp` */ diff --git a/src/targets/nsis.ts b/src/targets/nsis.ts index f0156ccd250..fa1478867fd 100644 --- a/src/targets/nsis.ts +++ b/src/targets/nsis.ts @@ -85,7 +85,7 @@ export default class NsisTarget extends Target { const appInfo = packager.appInfo const version = appInfo.version const installerFilename = `${appInfo.productFilename} Setup ${version}.exe` - const iconPath = await packager.getIconPath() + const iconPath = await this.packager.getResource(this.options.installerIcon, "installerIcon.ico") || await this.packager.getIconPath() const installerPath = path.join(this.outDir, installerFilename) const guid = this.options.guid || await BluebirdPromise.promisify(uuid5)({namespace: ELECTRON_BUILDER_NS_UUID, name: appInfo.id})