Skip to content

Commit 64937b2

Browse files
committed
fix(nsis): do not delete app data by default
Closes #769
1 parent c45adca commit 64937b2

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

templates/nsis/installSection.nsh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,17 @@
2828
${else}
2929
StrCpy $0 "/allusers"
3030
${endif}
31-
ExecWait '"$PLUGINSDIR\old-uninstaller.exe" /S /KEEP_APP_DATA $0 _?=$R1'
31+
32+
ClearErrors
33+
${GetParameters} $R4
34+
${GetOptions} $R4 "--delete-app-data" $R5
35+
${ifNot} ${Errors}
36+
StrCpy $1 "--delete-app-data"
37+
${else}
38+
StrCpy $1 ""
39+
${endif}
40+
41+
ExecWait '"$PLUGINSDIR\old-uninstaller.exe" /S /KEEP_APP_DATA $0 $1 _?=$R1'
3242
${endif}
3343
${endif}
3444
!macroend

templates/nsis/uninstaller.nsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Section "un.install"
4444

4545
ClearErrors
4646
${GetParameters} $R0
47-
${GetOptions} $R0 "/KEEP_APP_DATA" $R1
48-
${If} ${Errors}
47+
${GetOptions} $R0 "--delete-app-data" $R1
48+
${IfNot} ${Errors}
4949
# electron always uses per user app data
5050
${if} $installMode == "all"
5151
SetShellVarContext current

test/src/nsisTest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ async function doTest(outDir: string, perUser: boolean) {
103103
fsChanges = diff(fsBefore, fsAfter, driveC)
104104
assertThat(fsChanges.added).isEqualTo([])
105105
assertThat(fsChanges.deleted).isEqualTo([])
106+
107+
await assertThat(appDataFile).isFile()
108+
109+
await wine.exec(path.join(outDir, "TestApp Setup 1.1.0.exe"), "/S", "--delete-app-data")
110+
await assertThat(appDataFile).doesNotExist()
106111
}
107112

108113
test.ifNotCiOsx("boring", app({

0 commit comments

Comments
 (0)