Skip to content

Commit

Permalink
Added recursive delete function and fixed bug where uninstaller was n…
Browse files Browse the repository at this point in the history
…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 committed Dec 9, 2006
1 parent 560f918 commit 6887df0
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 22 deletions.
59 changes: 59 additions & 0 deletions win_build/RecursiveDelete.nsh
@@ -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
21 changes: 10 additions & 11 deletions win_build/qgis-debug.nsi
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"


Expand Down
22 changes: 11 additions & 11 deletions win_build/qgis.nsi
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -170,6 +172,7 @@ Function un.onInit
Abort
FunctionEnd


Section Uninstall
# remove the variable
Push PROJ_LIB
Expand All @@ -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.