From 4a61d6bd7e4b5e3a315a9c83526167514744ad21 Mon Sep 17 00:00:00 2001 From: Nate Weibley Date: Tue, 15 Mar 2016 11:38:40 -0400 Subject: [PATCH] Also automatically uninstall the previous version immediately before install. Fixes #2970 --- deploy/qgroundcontrol_installer.nsi | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/deploy/qgroundcontrol_installer.nsi b/deploy/qgroundcontrol_installer.nsi index 3f9014a48..37e30cd2e 100644 --- a/deploy/qgroundcontrol_installer.nsi +++ b/deploy/qgroundcontrol_installer.nsi @@ -55,6 +55,17 @@ InstallDir $PROGRAMFILES\qgroundcontrol !insertmacro MUI_LANGUAGE "English" Section + ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QGroundControl" "UninstallString" + StrCmp $R0 "" doinstall + + ExecWait "$R0 /S" + IntCmp $0 0 doinstall + + MessageBox MB_OK|MB_ICONEXCLAMATION \ + "Could not remove a previously installed QGroundControl version.$\n$\nPlease remove it before continuing." + Abort + +doinstall: SetOutPath $INSTDIR File /r build_windows_install\release\*.* File deploy\px4driver.msi @@ -112,12 +123,3 @@ Section "create Start Menu Shortcuts" !insertmacro DemoteShortCut "$SMPROGRAMS\$StartMenuFolder\QGroundControl (GPU Safe Mode).lnk" SectionEnd -Function .onInit - ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\QGroundControl" "UninstallString" - StrCmp $R0 "" done - - MessageBox MB_OK|MB_ICONEXCLAMATION \ - "QGroundControl is already installed. $\n$\nYou must uninstall the previous version before installing a new one." - Abort -done: -FunctionEnd -- 2.22.0