Skip to content

Commit

Permalink
feat: add installDir variable for NsisUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
panther7 committed May 31, 2022
1 parent a8418ac commit b1b5431
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-oranges-attack.md
@@ -0,0 +1,5 @@
---
"electron-updater": minor
---

Add installDir property for NsisUpdater. Now is it posible change install folder from AppUpdater.
3 changes: 3 additions & 0 deletions docs/api/electron-builder.md
Expand Up @@ -1599,6 +1599,9 @@ return path.join(target.outDir, <code>__${target.name}-${getArtifactArchName(arc
<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>
</li>
<li>
<p><code id="AppUpdater-installDir">installDir</code> = <code>''</code> String - <em>NSIS updater only</em> - Install folder for NSIS updater</p>
</li>
<li>
<p><code id="AppUpdater-currentVersion">currentVersion</code> SemVer - The current application version.</p>
</li>
<li>
Expand Down
6 changes: 6 additions & 0 deletions packages/electron-updater/src/AppUpdater.ts
Expand Up @@ -86,6 +86,12 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter

disableWebInstaller = false

/**
* Install dir for Nsis Updater
*
*/
installDir = ''

/**
* The current application version.
*/
Expand Down
5 changes: 5 additions & 0 deletions packages/electron-updater/src/NsisUpdater.ts
Expand Up @@ -109,6 +109,11 @@ export class NsisUpdater extends BaseUpdater {
args.push("--force-run")
}

if (this.installDir && typeof this.installDir === 'string') {
// maybe check if folder exists
args.push(`/D=${this.installDir}`)
}

const packagePath = this.downloadedUpdateHelper == null ? null : this.downloadedUpdateHelper.packageFile
if (packagePath != null) {
// only = form is supported
Expand Down

0 comments on commit b1b5431

Please sign in to comment.