Remove install folder on installation/uninstallation.
This commit is contained in:
parent
d0113124c7
commit
114d1077b7
1 changed files with 21 additions and 9 deletions
|
|
@ -536,8 +536,12 @@ Function InstDirValidation
|
||||||
Call isEmptyDir
|
Call isEmptyDir
|
||||||
Pop $0
|
Pop $0
|
||||||
StrCmp $0 0 0 isEmpty
|
StrCmp $0 0 0 isEmpty
|
||||||
MessageBox MB_OK "$INSTDIR is not empty. Please delete it and retry."
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION "The folder: $INSTDIR already exists.$\r$\n$\r$\nWould you like to install to that folder anyway?$\r$\nIt will be deleted before installation." IDYES true IDNO false
|
||||||
Abort
|
true:
|
||||||
|
Goto next
|
||||||
|
false:
|
||||||
|
Abort
|
||||||
|
next:
|
||||||
isEmpty:
|
isEmpty:
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
@ -683,6 +687,11 @@ FunctionEnd
|
||||||
Section "-Core installation"
|
Section "-Core installation"
|
||||||
;Use the entire tree produced by the INSTALL target. Keep the
|
;Use the entire tree produced by the INSTALL target. Keep the
|
||||||
;list of directories here in sync with the RMDir commands below.
|
;list of directories here in sync with the RMDir commands below.
|
||||||
|
|
||||||
|
Delete "$INSTDIR\*.*"
|
||||||
|
SetOutPath "$PROGRAMFILES"
|
||||||
|
RMDir /r "$INSTDIR"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
@CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
|
@CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
|
||||||
@CPACK_NSIS_FULL_INSTALL@
|
@CPACK_NSIS_FULL_INSTALL@
|
||||||
|
|
@ -881,13 +890,6 @@ Section "Uninstall"
|
||||||
Delete "$INSTDIR\AddRemove.exe"
|
Delete "$INSTDIR\AddRemove.exe"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
;Remove the uninstaller itself.
|
|
||||||
Delete "$INSTDIR\Uninstall.exe"
|
|
||||||
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
|
||||||
|
|
||||||
;Remove the installation directory if it is empty.
|
|
||||||
RMDir "$INSTDIR"
|
|
||||||
|
|
||||||
; Remove the registry entries.
|
; Remove the registry entries.
|
||||||
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||||
|
|
||||||
|
|
@ -895,6 +897,16 @@ Section "Uninstall"
|
||||||
!insertmacro SectionList "RemoveSection_CPack"
|
!insertmacro SectionList "RemoveSection_CPack"
|
||||||
|
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
||||||
|
|
||||||
|
;Remove the uninstaller itself.
|
||||||
|
Delete "$INSTDIR\Uninstall.exe"
|
||||||
|
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||||
|
|
||||||
|
Delete "$INSTDIR\*.*"
|
||||||
|
|
||||||
|
;Remove the installation directory.
|
||||||
|
SetOutPath "$PROGRAMFILES"
|
||||||
|
RMDir /r "$INSTDIR"
|
||||||
|
|
||||||
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||||
@CPACK_NSIS_DELETE_ICONS@
|
@CPACK_NSIS_DELETE_ICONS@
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue