From 0e9059c4db04dd169d6f591530567976c3fbed57 Mon Sep 17 00:00:00 2001 From: develar Date: Fri, 10 Feb 2017 11:47:05 +0100 Subject: [PATCH] feat(nsis): unicode option High Windows defender CPU usage when accessing NSIS installer Close #1165 --- docs/Options.md | 1 + packages/electron-builder/src/options/winOptions.ts | 5 +++++ packages/electron-builder/src/targets/nsis.ts | 6 +++--- test/src/windows/nsisTest.ts | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index 0627d2711a0..042bda4761c 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 | warningsAsErrors | Defaults to `true`. If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings. | menuCategory | Whether to create submenu for start menu shortcut and program files directory. Defaults to `false`. If `true`, company name will be used. Or string value. | artifactName | The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName} Setup ${version}.${ext}`. +| unicode | Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode). Defaults to `true`. ### `nsis` Web Installer Specific Options diff --git a/packages/electron-builder/src/options/winOptions.ts b/packages/electron-builder/src/options/winOptions.ts index 465c1906090..b5229c99e84 100644 --- a/packages/electron-builder/src/options/winOptions.ts +++ b/packages/electron-builder/src/options/winOptions.ts @@ -150,6 +150,11 @@ export interface NsisOptions { The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName} Setup ${version}.${ext}`. */ readonly artifactName?: string | null + + /* + Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode). Defaults to `true`. + */ + readonly unicode?: boolean } /* diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts index a6f0799285f..df7f8b19248 100644 --- a/packages/electron-builder/src/targets/nsis.ts +++ b/packages/electron-builder/src/targets/nsis.ts @@ -14,9 +14,9 @@ import sanitizeFileName from "sanitize-filename" import { copyFile } from "electron-builder-util/out/fs" import { computeDownloadUrl, getPublishConfigs, getPublishConfigsForUpdateInfo } from "../publish/PublishManager" -const NSIS_VERSION = "3.0.1.6" +const NSIS_VERSION = "3.0.1.7" //noinspection SpellCheckingInspection -const NSIS_SHA2 = "4bd85f3a54311fd55814ec87fbcb0ab9c64b3dea4179c891e7748df8748f87c8" +const NSIS_SHA2 = "0e797a7099283bf9caf97ee677e1d7986278c27b39916a501480978af039817c" //noinspection SpellCheckingInspection const ELECTRON_BUILDER_NS_UUID = "50e065bc-3134-11e6-9bab-38c9862bdaf3" @@ -149,7 +149,7 @@ export default class NsisTarget extends Target { OutFile: `"${installerPath}"`, VIProductVersion: appInfo.versionInWeirdWindowsForm, VIAddVersionKey: this.computeVersionKey(), - Unicode: true, + Unicode: options.unicode == null ? true : options.unicode, } if (packager.config.compression === "store") { diff --git a/test/src/windows/nsisTest.ts b/test/src/windows/nsisTest.ts index a47b800f7cb..602c39abfc2 100644 --- a/test/src/windows/nsisTest.ts +++ b/test/src/windows/nsisTest.ts @@ -20,6 +20,9 @@ test("one-click", app({ owner: "actperepo", package: "TestApp", }, + nsis: { + unicode: false, + } // wine creates incorrect filenames and registry entries for unicode, so, we use ASCII // productName: "TestApp", }