浏览代码

fix(bundler/nsis): Don't use /R flag on installation dir (#9282)

Fabian-Lars 1 年之前
父节点
当前提交
dbe81b8410
共有 2 个文件被更改,包括 9 次插入8 次删除
  1. 5 0
      .changes/bundler-r-flag.md
  2. 4 8
      tooling/bundler/src/bundle/windows/templates/installer.nsi

+ 5 - 0
.changes/bundler-r-flag.md

@@ -0,0 +1,5 @@
+---
+'tauri-bundler': 'patch:bug'
+---
+
+The NSIS uninstaller now won't mindlessly try to remove the whole installation folder when the "Remove application data" checkbox was ticked. This prevents data loss when the app was installed in a folder which contained other files.

+ 4 - 8
tooling/bundler/src/bundle/windows/templates/installer.nsi

@@ -641,14 +641,10 @@ Section Uninstall
   ; Delete uninstaller
   Delete "$INSTDIR\uninstall.exe"
 
-  ${If} $DeleteAppDataCheckboxState == 1
-    RMDir /R /REBOOTOK "$INSTDIR"
-  ${Else}
-    {{#each resources_ancestors}}
-    RMDir /REBOOTOK "$INSTDIR\\{{this}}"
-    {{/each}}
-    RMDir "$INSTDIR"
-  ${EndIf}
+  {{#each resources_ancestors}}
+  RMDir /REBOOTOK "$INSTDIR\\{{this}}"
+  {{/each}}
+  RMDir "$INSTDIR"
 
   ; Remove start menu shortcut
   !insertmacro MUI_STARTMENU_GETFOLDER Application $AppStartMenuFolder