Windows: check if there is already a previous install of Clementine and if so, ask the user if he wants to run the uninstaller. Running the installer will kill any running instance of Clementine, preventing installation issues because the files are used by this process and thus cannot be overwritten.

This commit is contained in:
Arnaud Bienner 2015-04-01 11:41:05 +02:00
parent ccf5bffd99
commit 8bd97a1d38
1 changed files with 20 additions and 0 deletions

View File

@ -111,10 +111,30 @@ ShowUnInstDetails show
@NORMAL@RequestExecutionLevel admin
@PORTABLE@RequestExecutionLevel user
; Check for previous installation, and call the uninstaller if any
Function CheckPreviousInstall
ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_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
FunctionEnd
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
Call CheckPreviousInstall
FunctionEnd
Function RunClementine