From a152a8920211f563a06920190c096252bcd689cd Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sat, 11 Aug 2018 12:32:46 -0700 Subject: [PATCH] Install new version does not delete AppData from previous install. --- deploy/qgroundcontrol_installer.nsi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index e3064b681..e1ede489b 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -2,6 +2,7 @@ !include LogicLib.nsh !include Win\COM.nsh !include Win\Propkey.nsh +!include "FileFunc.nsh" !macro DemoteShortCut target !insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 "" @@ -61,7 +62,7 @@ Section ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" StrCmp $R0 "" doinstall - ExecWait "$R0 /S _?=$INSTDIR" + ExecWait "$R0 /S _?=$INSTDIR -LEAVE_DATA=1" IntCmp $0 0 doinstall MessageBox MB_OK|MB_ICONEXCLAMATION \ @@ -104,12 +105,16 @@ done: SectionEnd Section "Uninstall" + ${GetParameters} $R0 + ${GetOptions} $R0 "-LEAVE_DATA=" $R1 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder SetShellVarContext all RMDir /r /REBOOTOK $INSTDIR RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\" SetShellVarContext current - RMDir /r /REBOOTOK "$APPDATA\${ORGNAME}\" + ${If} $R1 != 1 + RMDir /r /REBOOTOK "$APPDATA\${ORGNAME}\" + ${Endif} DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" SectionEnd -- 2.22.0