summaryrefslogtreecommitdiff
path: root/packaging/windows/setup.nsi
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-18 22:23:13 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-18 22:45:41 +0300
commit1b076b92f9a63a3f8216b1cd037df71b6bc03711 (patch)
tree624530f331bae872bb449636ec6799fb19b0e237 /packaging/windows/setup.nsi
parentaf90f5ef81c95cdec378377c3100a4417e0a1708 (diff)
downloadmanaverse-1b076b92f9a63a3f8216b1cd037df71b6bc03711.tar.gz
manaverse-1b076b92f9a63a3f8216b1cd037df71b6bc03711.tar.bz2
manaverse-1b076b92f9a63a3f8216b1cd037df71b6bc03711.tar.xz
manaverse-1b076b92f9a63a3f8216b1cd037df71b6bc03711.zip
Add uninstall before install to windows installer.
Diffstat (limited to 'packaging/windows/setup.nsi')
-rw-r--r--packaging/windows/setup.nsi25
1 files changed, 25 insertions, 0 deletions
diff --git a/packaging/windows/setup.nsi b/packaging/windows/setup.nsi
index 17833ddfc..07e649414 100644
--- a/packaging/windows/setup.nsi
+++ b/packaging/windows/setup.nsi
@@ -177,6 +177,31 @@ Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
InitPluginsDir
File /oname=$PLUGINSDIR\setup_finish.bmp "setup_finish.bmp"
+
+ ReadRegStr $R0 HKLM \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
+ "UninstallString"
+ StrCmp $R0 "" done
+
+ MessageBox MB_YESNO|MB_ICONEXCLAMATION \
+ "${PRODUCT_NAME} is already installed. $\n$\nClick `YES` (recomended) to remove the \
+ previous version or `NO` to install new version over old version." \
+ IDYES 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
Section "Core files (required)" SecCore