From cafa6fdbc368d4f5e56d60eb2c6a01d2a13a22de Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Tue, 31 Oct 2023 16:11:53 +0100 Subject: [PATCH] Uninstall previous version when installing to same directory (#664) Fixes #662 --- dist/win/mediawriter.nsi | 5 ++++- dist/win/mediawriter_native.nsi | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/win/mediawriter.nsi b/dist/win/mediawriter.nsi index 89490b29..b1cf020f 100644 --- a/dist/win/mediawriter.nsi +++ b/dist/win/mediawriter.nsi @@ -165,6 +165,9 @@ function .onInit functionEnd section "install" + ; Uninstall previous version when installing to same directory + ExecWait '"$INSTDIR\uninstall.exe" /S _?=$INSTDIR' + # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file) SetOutPath $INSTDIR SetOverwrite on @@ -209,7 +212,7 @@ sectionEnd SetShellVarContext all #Verify the uninstaller - last chance to back out - MessageBox MB_OKCANCEL "Permanently remove ${APPNAME}?" IDOK next + MessageBox MB_OKCANCEL "Do you want to uninstall ${APPNAME}?" IDOK next Abort next: !insertmacro VerifyUserIsAdmin diff --git a/dist/win/mediawriter_native.nsi b/dist/win/mediawriter_native.nsi index af0dd24f..2856a386 100644 --- a/dist/win/mediawriter_native.nsi +++ b/dist/win/mediawriter_native.nsi @@ -165,6 +165,9 @@ function .onInit functionEnd section "install" + ; Uninstall previous version when installing to same directory + ExecWait '"$INSTDIR\uninstall.exe" /S _?=$INSTDIR' + # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file) SetOutPath $INSTDIR SetOverwrite on @@ -209,7 +212,7 @@ sectionEnd SetShellVarContext all #Verify the uninstaller - last chance to back out - MessageBox MB_OKCANCEL "Permanently remove ${APPNAME}?" IDOK next + MessageBox MB_OKCANCEL "Do you want to uninstall ${APPNAME}?" IDOK next Abort next: !insertmacro VerifyUserIsAdmin