Skip to content

Commit

Permalink
feat: Add installDir property for NsisUpdater (#6907)
Browse files Browse the repository at this point in the history
  • Loading branch information
panther7 authored Jul 5, 2022
1 parent e7912d9 commit e7f2867
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-oranges-attack.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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-installDirectory">installDirectory</code> string | “undefined”- <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
12 changes: 12 additions & 0 deletions packages/electron-updater/src/NsisUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import { URL } from "url"
import { gunzipSync } from "zlib"

export class NsisUpdater extends BaseUpdater {
/**
* Install dir
*
*/
installDirectory: string | null = null


constructor(options?: AllPublishOptions | null, app?: AppAdapter) {
super(options, app)
}
Expand Down Expand Up @@ -109,6 +116,11 @@ export class NsisUpdater extends BaseUpdater {
args.push("--force-run")
}

if (this.installDirectory) {
// maybe check if folder exists
args.push(`/D=${this.installDirectory}`)
}

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

0 comments on commit e7f2867

Please sign in to comment.