Skip to content

Commit 7d700a5

Browse files
committed
feat: add installDir variable for NsisUpdater
1 parent a8418ac commit 7d700a5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

docs/api/electron-builder.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,9 @@ return path.join(target.outDir, <code>__${target.name}-${getArtifactArchName(arc
15991599
<p>Currently false to prevent breaking the current API, but it should be changed to default true at some point that breaking changes are allowed.</p>
16001600
</li>
16011601
<li>
1602+
<p><code id="AppUpdater-installDir">installDir</code> = <code>''</code> String - <em>NSIS updater only</em> - Install folder for NSIS updater</p>
1603+
</li>
1604+
<li>
16021605
<p><code id="AppUpdater-currentVersion">currentVersion</code> SemVer - The current application version.</p>
16031606
</li>
16041607
<li>

packages/electron-updater/src/AppUpdater.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
8686

8787
disableWebInstaller = false
8888

89+
/**
90+
* Install dir for Nsis Updater
91+
*
92+
*/
93+
installDir = ''
94+
8995
/**
9096
* The current application version.
9197
*/

packages/electron-updater/src/NsisUpdater.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ export class NsisUpdater extends BaseUpdater {
109109
args.push("--force-run")
110110
}
111111

112+
if (this.installDir && typeof this.installDir === 'string') {
113+
// maybe check if folder exists
114+
args.push(`/D=${this.installDir}`)
115+
}
116+
112117
const packagePath = this.downloadedUpdateHelper == null ? null : this.downloadedUpdateHelper.packageFile
113118
if (packagePath != null) {
114119
// only = form is supported

0 commit comments

Comments
 (0)