Skip to content

Commit

Permalink
fix(bundler/nsis): revert shell context change before deleting appdata,
Browse files Browse the repository at this point in the history
closes #7588 (#7591)

* fix(bundler/nsis): delete app data of current user when uninstall, closes #7588

* fix(bundler/nsis): delete app data of current user when uninstall, closes #7588

* Update .changes/fix-nsis-uninstall-delete-app-data.md

---------
  • Loading branch information
jetli authored Aug 15, 2023
1 parent 9308dee commit ca977f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-nsis-uninstall-delete-app-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

On Windows, Fix NSIS uninstaller deleting the wrong application data if the delete the application data checkbox is checked.
13 changes: 7 additions & 6 deletions tooling/bundler/src/bundle/windows/templates/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,6 @@ Section Uninstall
; Remove desktop shortcuts
Delete "$DESKTOP\${MAINBINARYNAME}.lnk"

; Delete app data
${If} $DeleteAppDataCheckboxState == 1
RmDir /r "$APPDATA\${BUNDLEID}"
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
${EndIf}

; Remove registry information for add/remove programs
!if "${INSTALLMODE}" == "both"
DeleteRegKey SHCTX "${UNINSTKEY}"
Expand All @@ -662,6 +656,13 @@ Section Uninstall

DeleteRegValue HKCU "${MANUPRODUCTKEY}" "Installer Language"

; Delete app data
${If} $DeleteAppDataCheckboxState == 1
SetShellVarContext current
RmDir /r "$APPDATA\${BUNDLEID}"
RmDir /r "$LOCALAPPDATA\${BUNDLEID}"
${EndIf}

${GetOptions} $CMDLINE "/P" $R0
IfErrors +2 0
SetAutoClose true
Expand Down

0 comments on commit ca977f4

Please sign in to comment.