Code

Change to the new Tango-compliant icon in the few places where the
[inkscape.git] / packaging / win32 / inkscape.nsi
index b7fa1353b5383865e2f1647b45cfffad236fad21..6a9b7d736e204d5b4c2d2fcb93a3b716a8a7e016 100644 (file)
@@ -12,6 +12,7 @@
 !define PRODUCT_WEB_SITE "http://www.inkscape.org"
 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
+;!define UNINST_EXE "uninstall.exe"
 
 
 
@@ -29,6 +30,29 @@ SetCompressor /SOLID lzma
 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
 !define MUI_COMPONENTSPAGE_SMALLDESC
 
+;..................................................................................................
+;Following two definitions required. Uninstall log will use these definitions.
+;You may use these definitions also, when you want to set up the InstallDirRagKey,
+;store the language selection, store Start Menu folder etc.
+;Enter the windows uninstall reg sub key to add uninstall information to Add/Remove Programs also.
+
+!define INSTDIR_REG_ROOT "HKLM"
+!define INSTDIR_REG_KEY ${PRODUCT_UNINST_KEY}
+
+;include the Uninstall log header
+!include AdvUninstLog.nsh
+
+;Specify the preferred uninstaller operation mode, either unattended or interactive.
+;You have to type either !insertmacro UNATTENDED_UNINSTALL, or !insertmacro INTERACTIVE_UNINSTALL.
+;Be aware only one of the following two macros has to be inserted, neither both, neither none.
+
+;!insertmacro UNATTENDED_UNINSTALL
+!insertmacro INTERACTIVE_UNINSTALL
+
+!addplugindir .
+!include "FileFunc.nsh"
+!insertmacro un.GetParent
+
 
 ; Welcome page
 !insertmacro MUI_PAGE_WELCOME
@@ -69,10 +93,12 @@ ShowUninstDetails hide
 
 ; Language files
 !include "english.nsh" 
-!include "catalan.nsh" 
+!include "breton.nsh"
+!include "catalan.nsh"
 !include "czech.nsh" 
 !include "finnish.nsh" 
 !include "french.nsh" 
+!include "galician.nsh" 
 !include "german.nsh" 
 !include "italian.nsh" 
 !include "japanese.nsh"
@@ -83,6 +109,8 @@ ShowUninstDetails hide
 !include "spanish.nsh" 
 
 ReserveFile "inkscape.nsi.uninstall"
+ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions
 
 
 ; #######################################
@@ -401,26 +429,42 @@ FunctionEnd
 !macro Language polng lng
   SectionIn 1 2 3
   SetOutPath $INSTDIR
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a "..\..\inkscape\*.${lng}.txt"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\locale
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r "..\..\inkscape\locale\${polng}"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\lib\locale
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}"
-  SetOutPath $INSTDIR\share\cliparts
-  File /nonfatal /a /r "..\..\inkscape\share\cliparts\*.${polng}.svg"  
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
+  SetOutPath $INSTDIR\share\clipart
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
+  File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${polng}.svg"  
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   ; the keyboard tables
   SetOutPath $INSTDIR\share\screens
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r "..\..\inkscape\share\screens\*.${polng}.svg"  
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\share\templates
-  File /nonfatal /a /r "..\..\inkscape\share\templates\default.${polng}.svg"  
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
+  File /nonfatal /a /r "..\..\inkscape\share\templates\*.${polng}.svg"  
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\doc
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml"  
   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html"  
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SectionGetFlags ${SecTutorials} $R1 
   IntOp $R1 $R1 & ${SF_SELECTED} 
   IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials 
     SetOutPath $INSTDIR\share\tutorials
+    !insertmacro UNINSTALL.LOG_OPEN_INSTALL
     File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*"
+    !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   skip_tutorials:
 !macroend
 
@@ -445,7 +489,9 @@ FunctionEnd
     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
     StrCmp $2 "" delprefs-Loop
        DetailPrint "$2\Inkscape will be removed"
-    RMDir /r "$2\Inkscape"
+    Delete "$2\Inkscape\preferences.xml"
+    Delete "$2\Inkscape\extension-errors.log"
+    RMDir "$2\Inkscape"
     Goto delprefs-Loop
   delprefs-End:
 !macroend
@@ -453,54 +499,25 @@ FunctionEnd
 
 ;--------------------------------
 ; Installer Sections
-; @todo better idea is to call the original uninstaller first
 Section -removeInkscape
   ; check for an old installation and clean that dlls and stuff
-  ClearErrors
-  IfFileExists $INSTDIR\etc 0 doDeleteLib
-    DetailPrint "$INSTDIR\etc exists, will be removed"
-    RmDir /r $INSTDIR\etc
-       IfErrors 0 +4
-      DetailPrint "fatal: failed to delete $INSTDIR\etc"
-      DetailPrint "aborting installation"
-         Abort
-  doDeleteLib:
-
-  ClearErrors
-  IfFileExists $INSTDIR\lib 0 doDeleteLocale
-    DetailPrint "$INSTDIR\lib exists, will be removed"  
-    RmDir /r $INSTDIR\lib
-       IfErrors 0 +4
-      DetailPrint "fatal: failed to delete $INSTDIR\lib"
-      DetailPrint "aborting installation"
-         Abort
-  doDeleteLocale:
 
-  ClearErrors
-  IfFileExists $INSTDIR\locale 0 doDeleteDll
-    DetailPrint "$INSTDIR\locale exists, will be removed"
-    RmDir /r $INSTDIR\locale
-       IfErrors 0 +4
-      DetailPrint "fatal: failed to delete $INSTDIR\locale"
-      DetailPrint "aborting installation"
-         Abort
-  doDeleteDll:
-
-  ClearErrors
-  FindFirst $0 $1 $INSTDIR\*.dll
-    FindNextLoop:
-    StrCmp $1 "" FindNextDone
-    DetailPrint "$INSTDIR\$1 exists, will be removed"
-    Delete $INSTDIR\$1
-    IfErrors 0 +4
-      DetailPrint "fatal: failed to delete $INSTDIR\$1"
-      DetailPrint "aborting installation"
-      Abort
+FindFirstINSTDIR:
+    FindFirst $0 $1 $INSTDIR\*.*
+FindINSTDIR:
+    StrCmp $1 "" FindNextDoneINSTDIR
+    StrCmp $1 "." FindNextINSTDIR
+       StrCmp $1 ".." FindNextINSTDIR
+       Goto FoundSomethingINSTDIR
+FindNextINSTDIR:
     FindNext $0 $1
-    Goto FindNextLoop
-  FindNextDone:
-  
-  ;remove the old inkscape shortcuts from the startmenu
+       Goto FindINSTDIR
+FoundSomethingINSTDIR:
+       MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(lng_ClearDirectoryBefore)" /SD IDCANCEL IDRETRY FindFirstINSTDIR
+       Quit
+FindNextDoneINSTDIR:
+
+    ;remove the old inkscape shortcuts from the startmenu
   ;just in case they are still there
   SetShellVarContext current
   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
@@ -521,6 +538,7 @@ Section $(lng_Core) SecCore
 
   SectionIn 1 2 3 RO
   SetOutPath $INSTDIR
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   SetOverwrite on
   SetAutoClose false
 
@@ -529,6 +547,8 @@ Section $(lng_Core) SecCore
   File /a "..\..\inkscape\COPYING"
   File /a "..\..\inkscape\COPYING.LIB"
   File /a "..\..\inkscape\NEWS"
+  File /a "..\..\inkscape\gspawn-win32-helper.exe"
+  File /a "..\..\inkscape\gspawn-win32-helper-console.exe"
   File /nonfatal /a "..\..\inkscape\HACKING.txt"
   File /a "..\..\inkscape\README"
   File /nonfatal /a "..\..\inkscape\README.txt"
@@ -537,22 +557,31 @@ Section $(lng_Core) SecCore
   File /nonfatal /a /r "..\..\inkscape\doc"
   File /nonfatal /a /r "..\..\inkscape\plugins"
   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   ; this files are added because it slips through the filter
   SetOutPath $INSTDIR\share\clipart
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
   ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"  
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\share\extensions
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt"
   File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\share\icons
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /a "..\..\inkscape\share\icons\inkscape.file.png"
   File /a "..\..\inkscape\share\icons\inkscape.file.svg"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\modules
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
   SetOutPath $INSTDIR\python
-  File /nonfatal /a /r "..\..\inkscape\python\*.*"
-
-  
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
+  File /nonfatal /a /r "..\..\inkscape\python\*.*" 
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
 SectionEnd
 
 Section $(lng_GTKFiles) SecGTK
@@ -561,10 +590,12 @@ Section $(lng_GTKFiles) SecGTK
   
   SectionIn 1 2 3 RO
   SetOutPath $INSTDIR
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   SetOverwrite on
   File /a /r "..\..\inkscape\*.dll"
   File /a /r /x "locale" "..\..\inkscape\lib"
   File /a /r "..\..\inkscape\etc"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
 SectionEnd
 
 Section $(lng_Alluser) SecAlluser
@@ -662,13 +693,17 @@ SectionGroup $(lng_Addfiles) SecAddfiles
 Section $(lng_Examples) SecExamples
   SectionIn 1 2
   SetOutPath $INSTDIR\share
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
 SectionEnd
 
 Section $(lng_Tutorials) SecTutorials
   SectionIn 1 2
   SetOutPath $INSTDIR\share
+  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
+  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
 SectionEnd
 
 SectionGroupEnd
@@ -679,6 +714,10 @@ Section $(lng_am) SecAmharic
   !insertmacro Language am am
 SectionEnd
 
+Section $(lng_ar) SecArabic
+  !insertmacro Language ar ar
+SectionEnd
+
 Section $(lng_az) SecAzerbaijani
   !insertmacro Language az az
 SectionEnd
@@ -695,10 +734,18 @@ Section $(lng_bn) SecBengali
   !insertmacro Language bn bn
 SectionEnd
 
+Section $(lng_br) SecBreton
+  !insertmacro Language br br
+SectionEnd
+
 Section $(lng_ca) SecCatalan
   !insertmacro Language ca ca
 SectionEnd
 
+Section $(lng_ca@valencia) SecCatalanValencia
+  !insertmacro Language ca@valencia ca@valencia
+SectionEnd
+
 Section $(lng_cs) SecCzech
   !insertmacro Language cs cs
 SectionEnd
@@ -763,7 +810,7 @@ Section $(lng_fr) SecFrench
   !insertmacro Language 'fr' 'fr'
 SectionEnd
 
-Section $(lng_fi) SecFinish
+Section $(lng_fi) SecFinnish
   !insertmacro Language 'fi' 'fi'
 SectionEnd
 
@@ -776,6 +823,11 @@ Section $(lng_gl) SecGallegan
   SectionIn 1 2 3
 SectionEnd
 
+Section $(lng_he) SecHebrew
+  !insertmacro Language he he
+  SectionIn 1 2 3
+SectionEnd
+
 Section $(lng_hr) SecCroatian
   !insertmacro Language hr hr
   SectionIn 1 2 3
@@ -880,8 +932,8 @@ Section $(lng_sr) SecSerbian
   !insertmacro Language sr sr
 SectionEnd
 
-Section $(lng_sr@Latn) SecSerbianLatin
-  !insertmacro Language 'sr@Latn' 'sr@Latn'
+Section $(lng_sr@latin) SecSerbianLatin
+  !insertmacro Language 'sr@latin' 'sr@latin'
 SectionEnd
 
 Section $(lng_sv) SecSwedish
@@ -916,6 +968,7 @@ SectionGroupEnd
 
 
 Section -FinalizeInstallation
+       DetailPrint "finalize installation"
   StrCmp $MultiUser "1" "" SingleUser
     DetailPrint "admin mode, registry root will be HKLM"
     SetShellVarContext all
@@ -946,8 +999,9 @@ Section -FinalizeInstallation
 
   ; uninstall settings
   ClearErrors
-  WriteUninstaller "$INSTDIR\uninst.exe"
-  WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
+  ; WriteUninstaller "$INSTDIR\uninst.exe"
+  WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${UNINST_EXE}"
+  WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR"
   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
@@ -956,6 +1010,33 @@ Section -FinalizeInstallation
   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
   IfErrors 0 +2
     DetailPrint "fatal: failed to write to registry un-installation info"
+
+  ;create/update log always within .onInstSuccess function
+  !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
+  
+       DetailPrint "create MD5 sums"
+       ClearErrors
+       FileOpen $0 $INSTDIR\uninstall.dat r
+       FileOpen $9 $INSTDIR\uninstall.log w
+       IfErrors doneinstall
+readnextlineinstall:
+       ClearErrors
+       FileRead $0 $1
+       IfErrors doneinstall
+       StrCpy $1 $1 -2
+       ;DetailPrint $1
+       md5dll::GetMD5File /NOUNLOAD $1
+       Pop $2
+       ;DetailPrint $2
+       StrCmp $2 "" +2
+       FileWrite $9 "$2  $1$\r$\n"
+       Goto readnextlineinstall
+doneinstall:
+       FileClose $0
+       FileClose $9
+       ; this file is not needed anymore
+       Delete $INSTDIR\uninstall.dat
+       
 SectionEnd
  
 ; Last the Descriptions
@@ -992,6 +1073,9 @@ SectionEnd
 !macroend
 
 Function .onInit
+  ;prepare log always within .onInit function
+  !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
+
   ;Extract InstallOptions INI files
   StrCpy $AskMultiUser "1"
   StrCpy $MultiUser "0"
@@ -1052,9 +1136,10 @@ Function .onInit
        ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
        StrCmp $R0 "" uninstall_before_done
         
-         MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done 
+         MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDNO uninstall_before_done 
          ;Run the uninstaller
          ;uninst:
+               DetailPrint "execute $R0 in $INSTDIR"
            ClearErrors
            ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
          uninstall_before_done:
@@ -1073,11 +1158,14 @@ Function .onInit
   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
   !insertmacro Parameter "am" ${SecAmharic}
+  !insertmacro Parameter "ar" ${SecArabic}
   !insertmacro Parameter "az" ${SecAzerbaijani}
   !insertmacro Parameter "be" ${SecByelorussian}
   !insertmacro Parameter "bg" ${SecBulgarian}
   !insertmacro Parameter "bn" ${SecBengali}
+  !insertmacro Parameter "br" ${SecBreton}
   !insertmacro Parameter "ca" ${SecCatalan}
+  !insertmacro Parameter "ca@valencia" ${SecCatalanValencia}
   !insertmacro Parameter "cs" ${SecCzech}
   !insertmacro Parameter "da" ${SecDanish}
   !insertmacro Parameter "de" ${SecGerman}
@@ -1092,10 +1180,11 @@ Function .onInit
   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
   !insertmacro Parameter "et" ${SecEstonian}
   !insertmacro Parameter "eu" ${SecBasque}
-  !insertmacro Parameter "fi" ${SecFinish}
+  !insertmacro Parameter "fi" ${SecFinnish}
   !insertmacro Parameter "fr" ${SecFrench}
   !insertmacro Parameter "ga" ${SecIrish}
   !insertmacro Parameter "gl" ${SecGallegan}
+  !insertmacro Parameter "he" ${SecHebrew}
   !insertmacro Parameter "hr" ${SecCroatian}
   !insertmacro Parameter "hu" ${SecHungarian}
   !insertmacro Parameter "id" ${SecIndonesian}
@@ -1121,7 +1210,7 @@ Function .onInit
   !insertmacro Parameter "sl" ${SecSlovenian}
   !insertmacro Parameter "sq" ${SecAlbanian}
   !insertmacro Parameter "sr" ${SecSerbian}
-  !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
+  !insertmacro Parameter "sr@latin" ${SecSerbianLatin}
   !insertmacro Parameter "sv" ${SecSwedish}
   !insertmacro Parameter "th" ${SecThai}
   !insertmacro Parameter "tr" ${SecTurkish}
@@ -1158,6 +1247,11 @@ FunctionEnd
 Function .onSelChange
 FunctionEnd
 
+
+Function .onInstSuccess
+
+FunctionEnd
+
 ; --------------------------------------------------
 
 Function un.CustomPageUninstall
@@ -1168,12 +1262,18 @@ Function un.CustomPageUninstall
   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
   DetailPrint "keepfiles = $MultiUser" 
-         ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
+         ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser"
 
 FunctionEnd
 
 
 Function un.onInit
+  ;begin uninstall, could be added on top of uninstall section instead
+  ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
+       IfFileExists $INSTDIR\uninstall.log uninstalllogpresent
+       MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
+       Quit
+uninstalllogpresent:
   ClearErrors
   StrCpy $User ""
        UserInfo::GetName
@@ -1213,6 +1313,59 @@ Function un.onInit
    
 FunctionEnd
 
+# removes a file and if the directory is empty afterwards the directory also
+# push md5, push filename, call unremovefilename
+Function un.RemoveFile
+       Var /Global filename
+       Var /Global md5sum
+       Var /Global ismd5sum
+       Var /Global removenever ; never remove a touched file
+       Var /Global removealways        ; always remove files touched by user
+       Pop $filename
+       Pop $md5sum
+       
+       IfFileExists $filename +2 0
+               Return
+       StrCmp $removealways "always" unremovefile 0
+       md5dll::GetMD5File /NOUNLOAD $filename
+       Pop $ismd5sum ;md5 of file
+       StrCmp $md5sum $ismd5sum  unremovefile 0
+       ;DetailPrint "uups MD5 does not match"
+       StrCmp $removenever "never" 0 +2
+               Return
+       ; the md5 sums does not match so we ask
+       messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "0,103" \
+               "$(lng_FileChanged)" "$(lng_Yes)" "$(lng_AlwaysYes)" "$(lng_No)" "$(lng_AlwaysNo)"
+       ;DetailPrint "messagebox finished"
+       Pop $md5sum
+       ;DetailPrint "messagebox call returned... $md5sum"
+       StrCmp $md5sum "1" unremovefile 0       ; Yes
+       StrCmp $md5sum "2" 0 unremoveno ; Yes always
+       StrCpy $removealways "always"
+       ;DetailPrint "removealways"
+       Goto unremovefile
+unremoveno:
+       StrCmp $md5sum "3" 0 unremovenever      ; No
+       ;DetailPrint "No remove"
+       Return
+unremovenever:
+       StrCpy $removenever "never"
+       ;DetailPrint "removenever"
+       Return
+unremovefile:
+       ;DetailPrint "removefile"
+       ClearErrors
+       Delete $filename
+       ;now recursivly remove the path
+unrmdir:
+       ${un.GetParent} $filename $filename
+       IfErrors 0 +2
+               Return
+       RMDir $filename
+       IfErrors +2
+               Goto unrmdir
+FunctionEnd
+
 Section Uninstall
 
   ; remove personal settings
@@ -1221,7 +1374,7 @@ Section Uninstall
     DetailPrint "purge personal settings in $APPDATA\Inkscape"
     ;RMDir /r "$APPDATA\Inkscape"
        !insertmacro delprefs
-  endPurge:
+       endPurge:
 
   ; Remove file associations for svg editor
   DetailPrint "removing file associations for svg editor"
@@ -1345,7 +1498,64 @@ Section Uninstall
   RMDir  "$SMPROGRAMS\Inkscape"
 
   DetailPrint "removing uninstall info"
-  RMDir /r "$INSTDIR"
+
+  ;uninstall from path, must be repeated for every install logged path individual
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\lib\locale"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\locale"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\doc"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\tutorials"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\templates"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\screens"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\clipart"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\extensions"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\icons"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\modules"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\python"
+  ;!insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
+
+  ;end uninstall, after uninstall from all logged paths has been performed
+  ;!insertmacro UNINSTALL.LOG_END_UNINSTALL
+
+  ;RMDir /r "$INSTDIR"
+  
+       StrCpy $removenever ""
+       StrCpy $removealways ""
+       
+       InitPluginsDir
+       SetPluginUnload manual
+       
+       ClearErrors
+       FileOpen $0 $INSTDIR\uninstall.log r
+       IfErrors uninstallnotfound
+readnextline:  
+       ClearErrors
+       FileRead $0 $1
+       IfErrors done
+       ; cat the line into md5 and filename
+       StrLen $2 $1
+       IntCmp $2 35 readnextline readnextline
+       StrCpy $3 $1 32
+       StrCpy $4 $1 $2-36 34   #remove trailing CR/LF
+       StrCpy $4 $4 -2
+       Push $3
+       Push $4
+       Call un.RemoveFile
+       Goto readnextline
+uninstallnotfound:
+       MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
+done:
+       FileClose $0
+
+       Delete "$INSTDIR\uninstall.log"
+       Delete "$INSTDIR\uninstall.exe"
+       ; remove empty directories
+       RMDir "$INSTDIR\data"
+       RMDir "$INSTDIR\doc"
+       RMDir "$INSTDIR\modules"
+       RMDir "$INSTDIR\plugins"
+       
+       RMDir $INSTDIR
 
   SetAutoClose false