diff --git a/packaging/windows/QET.nsi b/packaging/windows/QET.nsi index 4aba8a709..b6ea0ec3d 100644 --- a/packaging/windows/QET.nsi +++ b/packaging/windows/QET.nsi @@ -222,7 +222,6 @@ Section "" WriteINIStr "$SMPROGRAMS\${SOFT_NAME}\Upgrade\Download.url" "InternetShortcut" "URL" "http://download.tuxfamily.org/qet/builds/" ;changing $INSTDIR\elements\ *.elmt to read-only attribute - ${Locate} "$INSTDIR\elements\" "/L=FD /M=*.elmt" "LocateCallback" IfErrors 0 +2 MessageBox MB_OK "Error" @@ -238,6 +237,32 @@ FunctionEnd Function .onInit !insertmacro MUI_LANGDLL_DISPLAY + +;Auto-uninstall old before installing new + ReadRegStr $R0 HKLM \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SOFT_NAME}" \ + "UninstallString" + StrCmp $R0 "" done + + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ + "${SOFT_NAME} is already installed. $\n$\nClick `OK` to remove the \ + previous version or `Cancel` to cancel this upgrade." \ + IDOK uninst + Abort + +;Run the uninstaller +uninst: + ClearErrors + ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file + + IfErrors no_remove_uninstaller done + ;You can either use Delete /REBOOTOK in the uninstaller or add some code + ;here to remove the uninstaller. Use a registry key to check + ;whether the user has chosen to uninstall. If you are using an uninstaller + ;components page, make sure all sections are uninstalled. + no_remove_uninstaller: + +done: FunctionEnd diff --git a/packaging/windows/QET64.nsi b/packaging/windows/QET64.nsi index 827314a48..4c0b33d7c 100644 --- a/packaging/windows/QET64.nsi +++ b/packaging/windows/QET64.nsi @@ -256,6 +256,32 @@ ${Else} ${EndIf} !insertmacro MUI_LANGDLL_DISPLAY +;Auto-uninstall old before installing new + ReadRegStr $R0 HKLM \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SOFT_NAME}" \ + "UninstallString" + StrCmp $R0 "" done + + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ + "${SOFT_NAME} is already installed. $\n$\nClick `OK` to remove the \ + previous version or `Cancel` to cancel this upgrade." \ + IDOK uninst + Abort + +;Run the uninstaller +uninst: + ClearErrors + ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file + + IfErrors no_remove_uninstaller done + ;You can either use Delete /REBOOTOK in the uninstaller or add some code + ;here to remove the uninstaller. Use a registry key to check + ;whether the user has chosen to uninstall. If you are using an uninstaller + ;components page, make sure all sections are uninstalled. + no_remove_uninstaller: + +done: + FunctionEnd ;--------------------------------