Skip to content
Permalink
Browse files

Added recursive delete function and fixed bug where uninstaller was n…

…ot properly removing all of qgis (why anyone would want to remove it anyway is beyond me...)

Added RecursiveDelete.nsh to assist in above fix
Renamed qgis_window_geometry.nsi to qgis_window_geometry.nsh for better file nameing consistency

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6222 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Dec 9, 2006
1 parent 560f918 commit 6887df0978b747571271d5f2816cac8ae17bdaf4
@@ -0,0 +1,59 @@

; ################################################################
; appends \ to the path if missing
; example: !insertmacro GetCleanDir "c:\blabla"
; Pop $0 => "c:\blabla\"
!macro GetCleanDir INPUTDIR
; ATTENTION: USE ON YOUR OWN RISK!
; Please report bugs here: http://stefan.bertels.org/
!define Index_GetCleanDir 'GetCleanDir_Line${__LINE__}'
Push $R0
Push $R1
StrCpy $R0 "${INPUTDIR}"
StrCmp $R0 "" ${Index_GetCleanDir}-finish
StrCpy $R1 "$R0" "" -1
StrCmp "$R1" "\" ${Index_GetCleanDir}-finish
StrCpy $R0 "$R0\"
${Index_GetCleanDir}-finish:
Pop $R1
Exch $R0
!undef Index_GetCleanDir
!macroend

; ################################################################
; similar to "RMDIR /r DIRECTORY", but does not remove DIRECTORY itself
; example: !insertmacro RemoveFilesAndSubDirs "$INSTDIR"
!macro RemoveFilesAndSubDirs DIRECTORY
; ATTENTION: USE ON YOUR OWN RISK!
; Please report bugs here: http://stefan.bertels.org/
!define Index_RemoveFilesAndSubDirs 'RemoveFilesAndSubDirs_${__LINE__}'

Push $R0
Push $R1
Push $R2

!insertmacro GetCleanDir "${DIRECTORY}"
Pop $R2
FindFirst $R0 $R1 "$R2*.*"
${Index_RemoveFilesAndSubDirs}-loop:
StrCmp $R1 "" ${Index_RemoveFilesAndSubDirs}-done
StrCmp $R1 "." ${Index_RemoveFilesAndSubDirs}-next
StrCmp $R1 ".." ${Index_RemoveFilesAndSubDirs}-next
IfFileExists "$R2$R1\*.*" ${Index_RemoveFilesAndSubDirs}-directory
; file
Delete "$R2$R1"
goto ${Index_RemoveFilesAndSubDirs}-next
${Index_RemoveFilesAndSubDirs}-directory:
; directory
RMDir /r "$R2$R1"
${Index_RemoveFilesAndSubDirs}-next:
FindNext $R0 $R1
Goto ${Index_RemoveFilesAndSubDirs}-loop
${Index_RemoveFilesAndSubDirs}-done:
FindClose $R0

Pop $R2
Pop $R1
Pop $R0
!undef Index_RemoveFilesAndSubDirs
!macroend
@@ -13,6 +13,8 @@
SetCompressor zlib
; Added by Tim for setting env vars (see this file on disk)
!include WriteEnvStr.nsh
;Added by Tim for a macro that will recursively delete the files in the install dir
!include RecursiveDelete.nsh

; MUI 1.67 compatible ------
!include "MUI.nsh"
@@ -85,7 +87,7 @@ ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
!include qgis_window_geometry.nsi
!include qgis_window_geometry.nsh
SetOutPath "$INSTDIR"
SetOverwrite try
;------- Qt
@@ -178,23 +180,20 @@ Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst-debug.exe"
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.csv"
;----------------- subdirs
RMDir /r "$INSTDIR/grass"
RMDir /r "$INSTDIR/lib"
RMDir /r "$INSTDIR/share"
RMDir /r "$INSTDIR/nad"
RMDir /r "$INSTDIR/msys"

;----------------- icons and shortcuts
Delete "$SMPROGRAMS\$ICONS_GROUP\UninstallDebug.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$DESKTOP\Quantum GIS Debug.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Quantum GIS Debug.lnk"
RMDir "$SMPROGRAMS\$ICONS_GROUP"

;RMDir "$INSTDIR\plugins"

;----------------- The application dir gets zapped next ...
;I added this recursive delte implementation because
; RM -R wasnt working properly
Push "$INSTDIR"
!insertmacro RemoveFilesAndSubDirs "$INSTDIR\"
RMDir "$INSTDIR"


@@ -13,6 +13,8 @@
SetCompressor zlib
; Added by Tim for setting env vars (see this file on disk)
!include WriteEnvStr.nsh
;Added by Tim for a macro that will recursively delete the files in the install dir
!include RecursiveDelete.nsh

; MUI 1.67 compatible ------
!include "MUI.nsh"
@@ -85,7 +87,7 @@ ShowUnInstDetails show

Section "MainSection" SEC01
;Set the reg key so we get default toolbar layout
!include qgis_window_geometry.nsi
!include qgis_window_geometry.nsh
SetOutPath "$INSTDIR"
SetOverwrite try
;------- Qt
@@ -170,6 +172,7 @@ Function un.onInit
Abort
FunctionEnd


Section Uninstall
# remove the variable
Push PROJ_LIB
@@ -178,27 +181,24 @@ Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\*.exe"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.csv"
;----------------- subdirs
RMDir /r "$INSTDIR/grass"
RMDir /r "$INSTDIR/lib"
RMDir /r "$INSTDIR/share"
RMDir /r "$INSTDIR/nad"
RMDir /r "$INSTDIR/msys"

;----------------- icons and shortcuts
Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Website.lnk"
Delete "$DESKTOP\Quantum GIS.lnk"
Delete "$SMPROGRAMS\$ICONS_GROUP\Quantum GIS.lnk"
RMDir "$SMPROGRAMS\$ICONS_GROUP"

;RMDir "$INSTDIR\plugins"
;----------------- The application dir gets zapped next ...
;I added this recursive delte implementation because
; RM -R wasnt working properly
Push "$INSTDIR"
!insertmacro RemoveFilesAndSubDirs "$INSTDIR\"
RMDir "$INSTDIR"


DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd

File renamed without changes.

0 comments on commit 6887df0

Please sign in to comment.
You can’t perform that action at this time.