CPack/NSIS: Obtain path from which to uninstall from registry (#14124)

Without this, when CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL is set,
the installer tries to uninstall the old version from the default
installation path for the new version, rather than using the path from
the registry where the old version is installed.
This commit is contained in:
David Golub 2013-05-02 09:47:08 -04:00 committed by Brad King
parent e9e088a4df
commit 40566ef2f8
1 changed files with 3 additions and 1 deletions

View File

@ -916,7 +916,9 @@ Function .onInit
;Run the uninstaller ;Run the uninstaller
uninst: uninst:
ClearErrors ClearErrors
ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file StrLen $2 "\Uninstall.exe"
StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path
ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file
IfErrors uninst_failed inst IfErrors uninst_failed inst
uninst_failed: uninst_failed: