Skip to content

Commit

Permalink
fix(nsis): do not delete app data by default
Browse files Browse the repository at this point in the history
Closes #769
  • Loading branch information
develar committed Oct 2, 2016
1 parent c45adca commit 64937b2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 11 additions & 1 deletion templates/nsis/installSection.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@
${else}
StrCpy $0 "/allusers"
${endif}
ExecWait '"$PLUGINSDIR\old-uninstaller.exe" /S /KEEP_APP_DATA $0 _?=$R1'

ClearErrors
${GetParameters} $R4
${GetOptions} $R4 "--delete-app-data" $R5
${ifNot} ${Errors}
StrCpy $1 "--delete-app-data"
${else}
StrCpy $1 ""
${endif}

ExecWait '"$PLUGINSDIR\old-uninstaller.exe" /S /KEEP_APP_DATA $0 $1 _?=$R1'
${endif}
${endif}
!macroend
Expand Down
4 changes: 2 additions & 2 deletions templates/nsis/uninstaller.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Section "un.install"

ClearErrors
${GetParameters} $R0
${GetOptions} $R0 "/KEEP_APP_DATA" $R1
${If} ${Errors}
${GetOptions} $R0 "--delete-app-data" $R1
${IfNot} ${Errors}
# electron always uses per user app data
${if} $installMode == "all"
SetShellVarContext current
Expand Down
5 changes: 5 additions & 0 deletions test/src/nsisTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ async function doTest(outDir: string, perUser: boolean) {
fsChanges = diff(fsBefore, fsAfter, driveC)
assertThat(fsChanges.added).isEqualTo([])
assertThat(fsChanges.deleted).isEqualTo([])

await assertThat(appDataFile).isFile()

await wine.exec(path.join(outDir, "TestApp Setup 1.1.0.exe"), "/S", "--delete-app-data")
await assertThat(appDataFile).doesNotExist()
}

test.ifNotCiOsx("boring", app({
Expand Down

0 comments on commit 64937b2

Please sign in to comment.