Code

e6360a9dae475ca70e9a6ef5ea7ba61007d9cdfb
[inkscape.git] / packaging / win32 / inkscape.nsi
1 ; #######################################
2 ; Inkscape NSIS installer project file
3 ; Used as of 0.40
4 ; #######################################
6 ; #######################################
7 ; DEFINES
8 ; #######################################
9 !define PRODUCT_NAME "Inkscape"
10 !define PRODUCT_VERSION "0.46+devel"
11 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
12 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
13 ;!define DUMMYINSTALL ; Define this to make it build quickly, not including any of the files or code in the sections, for quick testing of features of the installer and development thereof.
15 ; #######################################
16 ; MUI   SETTINGS
17 ; #######################################
18 ; MUI 1.67 compatible ------
19 SetCompressor /SOLID lzma
20 RequestExecutionLevel highest
21 !include "MUI.nsh"
22 !include "LogicLib.nsh"
23 !include "sections.nsh"
24 !define MUI_ABORTWARNING
25 !define MUI_ICON "..\..\inkscape.ico";${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
26 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
27 !define MUI_HEADERIMAGE
28 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
29 !define MUI_WELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
30 !define MUI_COMPONENTSPAGE_SMALLDESC
32 ;..................................................................................................
33 ;Following two definitions required. Uninstall log will use these definitions.
34 ;You may use these definitions also, when you want to set up the InstallDirRagKey,
35 ;store the language selection, store Start Menu folder etc.
36 ;Enter the windows uninstall reg sub key to add uninstall information to Add/Remove Programs also.
38 !define INSTDIR_REG_ROOT HKLM
39 !define INSTDIR_REG_KEY ${PRODUCT_UNINST_KEY}
41 ;include the Uninstall log header
42 !include AdvUninstLog.nsh
43 !insertmacro INTERACTIVE_UNINSTALL
45 ;For md5dll and messagebox
46 !addplugindir .
48 !include FileFunc.nsh
49 !insertmacro GetParameters
50 !insertmacro GetOptions
51 !insertmacro un.GetParent
53 ; Welcome page
54 !insertmacro MUI_PAGE_WELCOME
55 ; License page
56 ; !define MUI_LICENSEPAGE_RADIOBUTTONS
57 LicenseForceSelection off
58 !define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON)
59 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT)
60 !insertmacro MUI_PAGE_LICENSE "..\..\Copying"
61 !insertmacro MUI_PAGE_COMPONENTS
62 ; InstType $(lng_Full)
63 ; InstType $(lng_Optimal)
64 ; InstType $(lng_Minimal)
65 ; Directory page
66 !insertmacro MUI_PAGE_DIRECTORY
67 ; Instfiles page
68 !insertmacro MUI_PAGE_INSTFILES
69 ; Finish page
70 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
71 !insertmacro MUI_PAGE_FINISH
73 ; Uninstaller pages
74 !insertmacro MUI_UNPAGE_CONFIRM
75 UninstPage custom un.CustomPageUninstall
76 !insertmacro MUI_UNPAGE_INSTFILES
77 ShowUninstDetails hide
78 !insertmacro MUI_UNPAGE_FINISH
80 ; #######################################
81 ; STRING   LOCALIZATION
82 ; #######################################
83 ; Thanks to Adib Taraben and Luca Bruno for getting this started
84 ; Add your translation here!  :-)
85 ; I had wanted to list the languages alphabetically, but apparently
86 ; the first is the default.  So putting English first is just being
87 ; practical.  It is not chauvinism or hubris, I swear!  ;-)
88 ; default language first
90 ; Language files
91 !insertmacro MUI_RESERVEFILE_LANGDLL
92 !include English.nsh
93 !include Breton.nsh
94 !include Catalan.nsh
95 !include Czech.nsh
96 !include Finnish.nsh
97 !include French.nsh
98 !include Galician.nsh
99 !include German.nsh
100 !include Italian.nsh
101 !include Japanese.nsh
102 !include Polish.nsh
103 !include Russian.nsh
104 !include Slovak.nsh
105 !include Slovenian.nsh
106 !include Spanish.nsh
107 !include TradChinese.nsh
109 ReserveFile "inkscape.nsi.uninstall"
110 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
111 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
113 ; #######################################
114 ; SETTINGS
115 ; #######################################
117 Name              "${PRODUCT_NAME}"
118 Caption           "$(lng_Caption)"
119 BrandingText      "$(lng_Caption)"
120 OutFile           "Inkscape-${PRODUCT_VERSION}-1.win32.exe"
121 InstallDir        "$PROGRAMFILES\Inkscape"
122 InstallDirRegKey  HKLM "${PRODUCT_DIR_REGKEY}" ""
124 Var askMultiUser
125 Var filename
126 Var MultiUser
127 Var User
128 Var CMDARGS
130 ; #######################################
131 ;  I N S T A L L E R    S E C T I O N S
132 ; #######################################
134 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
136 ;;;;;;;;;;;;;;;;;;;;;;;;;;
137 ; Delete prefs
138 ; code originally taken from the vlc project
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;
140 !macro delprefs
141   StrCpy $0 0
142   DetailPrint "Delete personal preferences ..."
143   DetailPrint "try to find all users ..."
144   ${Do}
145  ; FIXME
146   ; this will loop through all the logged users and "virtual" windows users
147   ; (it looks like users are only present in HKEY_USERS when they are logged in)
148     ClearErrors
149     EnumRegKey $1 HKU "" $0
150     ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
151     IntOp $0 $0 + 1
152     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
153     ${IfThen} $2 == "" ${|} ${Continue} ${|}
154     DetailPrint "$2\Inkscape will be removed"
155     Delete "$2\Inkscape\preferences.xml"
156     Delete "$2\Inkscape\extension-errors.log"
157     RMDir "$2\Inkscape"
158   ${Loop}
159 !macroend
162 ;--------------------------------
163 ; Installer Sections
164 Section -removeInkscape
165 !ifndef DUMMYINSTALL
166   ; check for an old installation and clean its DLLs etc.
167   FindFirst $0 $1 $INSTDIR\*.*
168   ${Do}
169     ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
170     ${If} $1 == "."
171     ${OrIf} $1 == ".."
172       FindNext $0 $1
173       ${Continue}
174     ${EndIf}
175     ${If} ${Cmd} ${|} MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(lng_ClearDirectoryBefore)" /SD IDCANCEL IDCANCEL ${|}
176       FindFirst $0 $1 $INSTDIR\*.*
177       ${Continue}
178     ${Else}
179     ${EndIf}
180   ${Loop}
181   ;remove the old Inkscape shortcuts from the startmenu
182   ;just in case they are still there
183   SetShellVarContext current
184   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
185   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
186   RMDir  "$SMPROGRAMS\Inkscape"
187   Delete "$SMPROGRAMS\Inkscape.lnk"
188   SetShellVarContext all
189   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
190   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
191   RMDir  "$SMPROGRAMS\Inkscape"
192   Delete "$SMPROGRAMS\Inkscape.lnk"
193 !endif
194 SectionEnd
196 Section $(lng_Core) SecCore
197   SectionIn 1 2 3 RO
198 !ifndef DUMMYINSTALL
199   DetailPrint "Installing Inkscape Core Files ..."
200   SetOutPath $INSTDIR
201   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
202   SetOverwrite on
203   SetAutoClose false
205   File /a "..\..\inkscape\ink*.exe"
206   File /a "..\..\inkscape\AUTHORS"
207   File /a "..\..\inkscape\COPYING"
208   File /a "..\..\inkscape\COPYING.LIB"
209   File /a "..\..\inkscape\NEWS"
210   File /a "..\..\inkscape\gspawn-win32-helper.exe"
211   File /a "..\..\inkscape\gspawn-win32-helper-console.exe"
212   File /nonfatal /a "..\..\inkscape\HACKING.txt"
213   File /a "..\..\inkscape\README"
214   File /nonfatal /a "..\..\inkscape\README.txt"
215   File /a "..\..\inkscape\TRANSLATORS"
216   File /nonfatal /a /r "..\..\inkscape\data"
217   File /nonfatal /a /r "..\..\inkscape\doc"
218   File /nonfatal /a /r "..\..\inkscape\plugins"
219   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
220   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
221   ; this files are added because it slips through the filter
222   SetOutPath $INSTDIR\share\clipart
223   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
224   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
225   ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"
226   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
227   SetOutPath $INSTDIR\share\icons
228   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
229   File /a "..\..\inkscape\share\icons\inkscape.file.png"
230   File /a "..\..\inkscape\share\icons\inkscape.file.svg"
231   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
232   SetOutPath $INSTDIR\modules
233   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
234   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
235   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
236   SetOutPath $INSTDIR\python
237   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
238   File /nonfatal /a /r "..\..\inkscape\python\*.*"
239   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
240 !endif
241 SectionEnd
243 Section $(lng_GTKFiles) SecGTK
244   SectionIn 1 2 3 RO
245 !ifndef DUMMYINSTALL
246   DetailPrint "Installing GTK Files ..."
247   SetOutPath $INSTDIR
248   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
249   SetOverwrite on
250   File /a /r "..\..\inkscape\*.dll"
251   File /a /r /x "locale" "..\..\inkscape\lib"
252   File /a /r "..\..\inkscape\etc"
253   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
254 !endif
255 SectionEnd
257 Section -SetCurrentUserOnly
258 !ifndef DUMMYINSTALL
259   StrCpy $MultiUser 0
260   SetShellVarContext current
261 !endif
262 SectionEnd
264 Section $(lng_Alluser) SecAlluser
265   SectionIn 1 2 3
266 !ifndef DUMMYINSTALL
267   ; disable this option in Win95/Win98/WinME
268   StrCpy $MultiUser 1
269   DetailPrint "admin mode, registry root will be HKLM"
270   SetShellVarContext all
271 !endif
272 SectionEnd
274 SectionGroup $(lng_Shortcuts) SecShortcuts
276 Section $(lng_Desktop) SecDesktop
277 !ifndef DUMMYINSTALL
278   ClearErrors
279   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
280   ${IfThen} ${Errors} ${|} DetailPrint "Uups! Problems creating desktop shortcuts" ${|}
281 !endif
282 SectionEnd
284 Section $(lng_Quicklaunch) SecQuicklaunch
285 !ifndef DUMMYINSTALL
286   ClearErrors
287   ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe" ${|}
288   ${IfThen} ${Errors} ${|} DetailPrint "Uups! Problems creating quicklaunch shortcuts" ${|}
289 !endif
290 SectionEnd
292 Section $(lng_SVGWriter) SecSVGWriter
293   SectionIn 1 2 3
294 !ifndef DUMMYINSTALL
295   ; create file associations, test before if needed
296   DetailPrint "creating file associations"
297   ClearErrors
298   ReadRegStr $0 HKCR ".svg" ""
299   ${If} $0 == ""
300     WriteRegStr HKCR ".svg" "" "svgfile"
301     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
302   ${EndIf}
303   ReadRegStr $0 HKCR ".svgz" ""
304   ${If} $0 == ""
305     WriteRegStr HKCR ".svgz" "" "svgfile"
306     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
307   ${EndIf}
308   ${IfThen} ${Errors} ${|} DetailPrint "Uups! Problems creating file assoziations for svg writer" ${|}
310   DetailPrint "creating default editor"
311   ClearErrors
312   ReadRegStr $0 HKCR ".svg" ""
313   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
314   ReadRegStr $0 HKCR ".svgz" ""
315   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
316   ${IfThen} ${Errors} ${|} DetailPrint "Uups! Problems creating default editor" ${|}
317 !endif
318 SectionEnd
320 Section $(lng_ContextMenu) SecContextMenu
321   SectionIn 1 2 3
322 !ifndef DUMMYINSTALL
323   ; create file associations, test before if needed
324   DetailPrint "creating file associations"
325   ClearErrors
326   ReadRegStr $0 HKCR ".svg" ""
327   ${If} $0 == ""
328     WriteRegStr HKCR ".svg" "" "svgfile"
329     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
330   ${EndIf}
332   ReadRegStr $0 HKCR ".svgz" ""
333   ${If} $0 == ""
334     WriteRegStr HKCR ".svgz" "" "svgfile"
335     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
336   ${EndIf}
338   ${IfThen} ${Errors} ${|} DetailPrint "Uups! Problems creating file assoziations for context menu" ${|}
340   DetailPrint "creating context menue"
341   ClearErrors
342   ReadRegStr $0 HKCR ".svg" ""
343   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
344   ReadRegStr $0 HKCR ".svgz" ""
345   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
346   ${IfThen} ${Errors} ${|} DetailPrint "Uups! Problems creating context menue integration" ${|}
347 !endif
348 SectionEnd
350 SectionGroupEnd
352 Section /o $(lng_DeletePrefs) SecPrefs
353 !ifndef DUMMYINSTALL
354   !insertmacro delprefs
355 !endif
356 SectionEnd
358 SectionGroup $(lng_Addfiles) SecAddfiles
360 Section $(lng_Examples) SecExamples
361   SectionIn 1 2
362 !ifndef DUMMYINSTALL
363   SetOutPath $INSTDIR\share
364   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
365   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
366   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
367 !endif
368 SectionEnd
370 Section $(lng_Tutorials) SecTutorials
371   SectionIn 1 2
372 !ifndef DUMMYINSTALL
373   SetOutPath $INSTDIR\share
374   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
375   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
376   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
377 !endif
378 SectionEnd
380 SectionGroupEnd
382 SectionGroup $(lng_Languages) SecLanguages
383   !macro Language SecName lng
384     Section /o $(lng_${lng}) Sec${SecName}
385       ;SectionIn 1 2 3
386 !ifndef DUMMYINSTALL
387       SetOutPath $INSTDIR
388       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
389       File /nonfatal /a "..\..\inkscape\*.${lng}.txt" ; FIXME: remove this?  No such files.
390       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
391       SetOutPath $INSTDIR\locale
392       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
393       File /nonfatal /a /r "..\..\inkscape\locale\${lng}"
394       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
395       SetOutPath $INSTDIR\lib\locale
396       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
397       File /nonfatal /a /r "..\..\inkscape\lib\locale\${lng}"
398       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
399       SetOutPath $INSTDIR\share\clipart
400       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
401       File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${lng}.svg"
402       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
403       ; the keyboard tables
404       SetOutPath $INSTDIR\share\screens
405       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
406       File /nonfatal /a /r "..\..\inkscape\share\screens\*.${lng}.svg"
407       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
408       SetOutPath $INSTDIR\share\templates
409       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
410       File /nonfatal /a /r "..\..\inkscape\share\templates\*.${lng}.svg"
411       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
412       SetOutPath $INSTDIR\doc
413       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
414       File /nonfatal /a /r "..\..\inkscape\doc\keys.${lng}.xml"
415       File /nonfatal /a /r "..\..\inkscape\doc\keys.${lng}.html"
416       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
417       SectionGetFlags ${SecTutorials} $R1
418       IntOp $R1 $R1 & ${SF_SELECTED}
419       ${If} $R1 >= ${SF_SELECTED}
420         SetOutPath $INSTDIR\share\tutorials
421         !insertmacro UNINSTALL.LOG_OPEN_INSTALL
422         File /nonfatal /a "..\..\inkscape\share\tutorials\*.${lng}.*"
423         !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
424       ${EndIf}
425     !endif
426     SectionEnd
427   !macroend
429   !insertmacro Language Amharic am
430   !insertmacro Language Arabic ar
431   !insertmacro Language Azerbaijani az
432   !insertmacro Language Byelorussian be
433   !insertmacro Language Bulgarian bg
434   !insertmacro Language Bengali bn
435   !insertmacro Language Breton br
436   !insertmacro Language Catalan ca
437   !insertmacro Language CatalanValencia ca@valencia
438   !insertmacro Language Czech cs
439   !insertmacro Language Danish da
440   !insertmacro Language German de
441   !insertmacro Language Dzongkha dz
442   !insertmacro Language Greek el
443   !insertmacro Language EnglishAustralian en_AU
444   !insertmacro Language EnglishCanadian en_CA
445   !insertmacro Language EnglishBritain en_GB
446   !insertmacro Language EnglishPiglatin en_US@piglatin
447   !insertmacro Language Esperanto eo
448   !insertmacro Language Spanish es
449   !insertmacro Language SpanishMexico es_MX
450   !insertmacro Language Estonian et
451   !insertmacro Language Basque eu
452   !insertmacro Language French fr
453   !insertmacro Language Finnish fi
454   !insertmacro Language Irish ga
455   !insertmacro Language Gallegan gl
456   !insertmacro Language Hebrew he
457   !insertmacro Language Croatian hr
458   !insertmacro Language Hungarian hu
459   !insertmacro Language Indonesian id
460   !insertmacro Language Italian it
461   !insertmacro Language Japanese ja
462   !insertmacro Language Khmer km
463   !insertmacro Language Korean ko
464   !insertmacro Language Lithuanian lt
465   !insertmacro Language Mongolian mn
466   !insertmacro Language Macedonian mk
467   !insertmacro Language NorwegianBokmal nb
468   !insertmacro Language Nepali ne
469   !insertmacro Language Dutch nl
470   !insertmacro Language NorwegianNynorsk nn
471   !insertmacro Language Panjabi pa
472   !insertmacro Language Polish pl
473   !insertmacro Language Portuguese pt
474   !insertmacro Language PortugueseBrazil pt_BR
475   !insertmacro Language Romanian ro
476   !insertmacro Language Russian ru
477   !insertmacro Language Kinyarwanda rw
478   !insertmacro Language Slovak sk
479   !insertmacro Language Slovenian sl
480   !insertmacro Language Albanian sq
481   !insertmacro Language Serbian sr
482   !insertmacro Language SerbianLatin sr@latin
483   !insertmacro Language Swedish sv
484   !insertmacro Language Thai th
485   !insertmacro Language Turkish tr
486   !insertmacro Language Ukrainian uk
487   !insertmacro Language Vietnamese vi
488   !insertmacro Language ChineseSimplified zh_CN
489   !insertmacro Language ChineseTaiwan zh_TW
490 SectionGroupEnd
493 Section -FinalizeInstallation
494 !ifndef DUMMYINSTALL
495   DetailPrint "finalize installation"
496   ${If} $MultiUser = 1
497     DetailPrint "admin mode, registry root will be HKLM"
498     SetShellVarContext all
499   ${Else}
500     DetailPrint "single user mode, registry root will be HKCU"
501     SetShellVarContext current
502   ${EndIf}
504   ; check for writing registry
505   ClearErrors
506   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"
507   ;${If} ${Errors}
508   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
509   ;  DetailPrint "aborting installation"
510   ;  Abort
511   ;${EndIf}
512   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" $MultiUser
513   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" $askMultiUser
514   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" $User
515   ${IfThen} ${Errors} ${|} DetailPrint "Fatal: failed to write to registry installation info" ${|}
517   ; start menu entries
518   ClearErrors
519   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
520   ${IfThen} ${Errors} ${|} DetailPrint "Fatal: failed to write to start menu info" ${|}
522   ; uninstall settings
523   ClearErrors
524   ; WriteUninstaller "$INSTDIR\uninst.exe"
525   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${UNINST_EXE}"
526   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR"
527   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
528   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
529   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
530   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
531   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
532   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
533   ${IfThen} ${Errors} ${|} DetailPrint "fatal: failed to write to registry un-installation info" ${|}
535   ;create/update log always within .onInstSuccess function
536   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
538   DetailPrint "Creating MD5 checksums..."
539   ClearErrors
540   FileOpen $0 $INSTDIR\Uninstall.dat r
541   FileOpen $9 $INSTDIR\Uninstall.log w
542   ${IfNot} ${Errors}
543     ${Do}
544       ClearErrors
545       FileRead $0 $1
546       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
547       StrCpy $1 $1 -2
548       md5dll::GetMD5File /NOUNLOAD $1
549       Pop $2
550       ${IfThen} $2 != "" ${|} FileWrite $9 "$2  $1$\r$\n" ${|}
551     ${Loop}
552   ${EndIf}
553   FileClose $0
554   FileClose $9
555   ; Not needed any more
556   Delete $INSTDIR\Uninstall.dat
557 !endif
558 SectionEnd
560 ; Last the Descriptions
561 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
562   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
563   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
564   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
565   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc)
566   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
567   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
568   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
569   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
570   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
571   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
572   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
573   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
574   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
575 !insertmacro MUI_FUNCTION_DESCRIPTION_END
577 !macro Parameter key Section
578   ${GetOptions} $CMDARGS "/${key}=" $1
579   ${If} $1 == "OFF"
580     SectionGetFlags ${Section} $0
581     IntOp $2 ${SF_SELECTED} ~
582     IntOp $0 $0 & $2
583     SectionSetFlags ${Section} $0
584   ${EndIf}
585   ${If} $1 == "ON"
586     SectionGetFlags ${Section} $0
587     IntOp $0 $0 | ${SF_SELECTED}
588     SectionSetFlags ${Section} $0
589   ${EndIf}
590 !macroend
592 Function .onInit
593   !insertmacro MUI_LANGDLL_DISPLAY
595   !macro LanguageAutoSelect SecName LocaleID
596     ${If} $LANGUAGE = ${LocaleID}
597       SectionGetFlags ${Sec${SecName}} $0
598       IntOp $0 $0 | ${SF_SELECTED}
599       SectionSetFlags ${Sec${SecName}} $0
600     ${EndIf}
601   !macroend
603   ;!insertmacro LanguageAutoSelect English 1033
604   !insertmacro LanguageAutoSelect Breton 1150
605   !insertmacro LanguageAutoSelect Catalan 1027
606   !insertmacro LanguageAutoSelect Czech 1029
607   !insertmacro LanguageAutoSelect Finnish 1035
608   !insertmacro LanguageAutoSelect French 1036
609   !insertmacro LanguageAutoSelect Gallegan 1110 ; Galician, but section is called Gallegan
610   !insertmacro LanguageAutoSelect German 1031
611   !insertmacro LanguageAutoSelect Italian 1040
612   !insertmacro LanguageAutoSelect Japanese 1041
613   !insertmacro LanguageAutoSelect Polish 1045
614   !insertmacro LanguageAutoSelect Russian 1049
615   !insertmacro LanguageAutoSelect Slovak 1051
616   !insertmacro LanguageAutoSelect Slovenian 1060
617   !insertmacro LanguageAutoSelect Spanish 1034
618   !insertmacro LanguageAutoSelect ChineseTaiwan 1028 ; TradChinese, but section is called ChineseTaiwan
620   ${GetParameters} $CMDARGS
621   ;prepare log always within .onInit function
622   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
624   ;Extract InstallOptions INI files
625   StrCpy $AskMultiUser "1"
626   StrCpy $MultiUser "0"
627   ; this resets AskMultiUser if Win95/98/ME
628   ClearErrors
629   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
630   ${If} ${Errors}
631     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
632     StrCpy $R0 $R0 1
633     ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|}
634   ${EndIf}
636   ; hide all user section if ME/9x
637   ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|}
639   ; hide if quick launch if not available
640   ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|}
642   ;check if user is admin
643   ClearErrors
644   UserInfo::GetName
645   ${If} ${Errors}
646     # This one means you don't need to care about admin or
647     # not admin because Windows 9x doesn't either
648     ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|}
649   ${Else}
650     Pop $User
651     UserInfo::GetAccountType
652     Pop $1
653     ${If} $1 != "Admin"
654     ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
655       Quit
656     ${EndIf}
657   ${EndIf}
659   ;check for previous installation
660   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
661   ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User" ${|}
662   ;check user if applicable
663   ${If} $0 != ""
664   ${AndIf} $0 != $User
665   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
666     Quit
667   ${EndIf}
669   ; call uninstall first
670   ; code taken from the vlc project
671     ReadRegStr $R0  HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
672     ReadRegStr $R1  HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
673     ${If} $R0 == ""
674       ReadRegStr $R0  HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
675       ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
676     ${EndIf}
677     ${If} $R0 != ""
678     ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES ${|}
679       ;Run the uninstaller
680       DetailPrint "Execute $R0 in $INSTDIR"
681       ClearErrors
682       ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
683     ${EndIf}
685   ; proccess command line parameter
686   !insertmacro Parameter "GTK" ${SecGTK}
687   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
688   !insertmacro Parameter "ALLUSER" ${SecAlluser}
689   !insertmacro Parameter "DESKTOP" ${SecDesktop}
690   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
691   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
692   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
693   !insertmacro Parameter "PREFERENCES" ${SecPrefs}
694   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
695   !insertmacro Parameter "EXAMPLES" ${SecExamples}
696   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
697   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
698   !insertmacro Parameter "am" ${SecAmharic}
699   !insertmacro Parameter "ar" ${SecArabic}
700   !insertmacro Parameter "az" ${SecAzerbaijani}
701   !insertmacro Parameter "be" ${SecByelorussian}
702   !insertmacro Parameter "bg" ${SecBulgarian}
703   !insertmacro Parameter "bn" ${SecBengali}
704   !insertmacro Parameter "br" ${SecBreton}
705   !insertmacro Parameter "ca" ${SecCatalan}
706   !insertmacro Parameter "ca@valencia" ${SecCatalanValencia}
707   !insertmacro Parameter "cs" ${SecCzech}
708   !insertmacro Parameter "da" ${SecDanish}
709   !insertmacro Parameter "de" ${SecGerman}
710   !insertmacro Parameter "dz" ${SecDzongkha}
711   !insertmacro Parameter "el" ${SecGreek}
712   !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
713   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
714   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
715   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
716   !insertmacro Parameter "eo" ${SecEsperanto}
717   !insertmacro Parameter "es" ${SecSpanish}
718   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
719   !insertmacro Parameter "et" ${SecEstonian}
720   !insertmacro Parameter "eu" ${SecBasque}
721   !insertmacro Parameter "fi" ${SecFinnish}
722   !insertmacro Parameter "fr" ${SecFrench}
723   !insertmacro Parameter "ga" ${SecIrish}
724   !insertmacro Parameter "gl" ${SecGallegan}
725   !insertmacro Parameter "he" ${SecHebrew}
726   !insertmacro Parameter "hr" ${SecCroatian}
727   !insertmacro Parameter "hu" ${SecHungarian}
728   !insertmacro Parameter "id" ${SecIndonesian}
729   !insertmacro Parameter "it" ${SecItalian}
730   !insertmacro Parameter "ja" ${SecJapanese}
731   !insertmacro Parameter "km" ${SecKhmer}
732   !insertmacro Parameter "ko" ${SecKorean}
733   !insertmacro Parameter "lt" ${SecLithuanian}
734   !insertmacro Parameter "mk" ${SecMacedonian}
735   !insertmacro Parameter "mn" ${SecMongolian}
736   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
737   !insertmacro Parameter "ne" ${SecNepali}
738   !insertmacro Parameter "nl" ${SecDutch}
739   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
740   !insertmacro Parameter "pa" ${SecPanjabi}
741   !insertmacro Parameter "pl" ${SecPolish}
742   !insertmacro Parameter "pt" ${SecPortuguese}
743   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
744   !insertmacro Parameter "ro" ${SecRomanian}
745   !insertmacro Parameter "ru" ${SecRussian}
746   !insertmacro Parameter "rw" ${SecKinyarwanda}
747   !insertmacro Parameter "sk" ${SecSlovak}
748   !insertmacro Parameter "sl" ${SecSlovenian}
749   !insertmacro Parameter "sq" ${SecAlbanian}
750   !insertmacro Parameter "sr" ${SecSerbian}
751   !insertmacro Parameter "sr@latin" ${SecSerbianLatin}
752   !insertmacro Parameter "sv" ${SecSwedish}
753   !insertmacro Parameter "th" ${SecThai}
754   !insertmacro Parameter "tr" ${SecTurkish}
755   !insertmacro Parameter "uk" ${SecUkrainian}
756   !insertmacro Parameter "vi" ${SecVietnamese}
757   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
758   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
760   ClearErrors
761   ${GetOptions} $CMDARGS "/?" $1
762   ${IfNot} ${Errors}
763     MessageBox MB_OK "Possible parameters for installer:$\r$\n \
764       /?: this help screen$\r$\n \
765       /S: silent$\r$\n \
766       /D=(directory): where to install Inkscape$\r$\n \
767       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
768       /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \
769       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
770       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
771       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
772       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
773       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
774       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
775       /ADDFILES=(OFF/ON): additional files$\r$\n \
776       /EXAMPLES=(OFF/ON): examples$\r$\n \
777       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
778       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
779       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
780     Abort
781   ${EndIf}
782 FunctionEnd
784 ; --------------------------------------------------
786 Function un.CustomPageUninstall
787   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
788   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
789   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
791   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
792   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
793   DetailPrint "keepfiles = $MultiUser"
794   ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser"
796 FunctionEnd
798 Function un.onInit
799   ;begin uninstall, could be added on top of uninstall section instead
800   ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
801   ${IfNot} ${FileExists} $INSTDIR\uninstall.log
802     MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
803     Quit
804   ${EndIf}
805   ClearErrors
806   StrCpy $User ""
807   UserInfo::GetName
808   ${IfNot} ${Errors}
809     Pop $0
810     StrCpy $User $0
811   ${EndIf}
812   StrCpy $askMultiUser 1
813   StrCpy $MultiUser 1
815   ; Test if this was a multiuser installation
816   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
817   ${If} $0 == "$INSTDIR\inkscape.exe"
818     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
819     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
820     ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
821   ${Else}
822     ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
823     ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
824     ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
825   ${EndIf}
826   ;check user if applicable
827   ${If} $0 != ""
828   ${AndIf} $0 != $User
829   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
830     Quit
831   ${EndIf}
833   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
835   SetShellVarContext all
836   ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|}
837 FunctionEnd
839 Section Uninstall
840 !ifndef DUMMYINSTALL
841   ; remove personal settings
842   Delete "$APPDATA\Inkscape\extension-errors.log"
843   ${If} $MultiUser = 0
844     DetailPrint "purge personal settings in $APPDATA\Inkscape"
845     ;RMDir /r "$APPDATA\Inkscape"
846     !insertmacro delprefs
847   ${EndIf}
849   ; Remove file associations for svg editor
850   StrCpy $3 "svg"
851   ${For} $2 0 1
852     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
853     DetailPrint "removing file associations for $3 editor"
854     ClearErrors
855     ReadRegStr $0 HKCR ".$3" ""
856     DetailPrint ".$3 associated as $0"
857     ${IfNot} ${Errors}
858       ReadRegStr $1 HKCR "$0\shell\edit\command" ""
859       ${IfNotThen} ${Errors} ${|} DetailPrint "$3 editor is $1" ${|}
860       ${If} $1 == '"$INSTDIR\Inkscape.exe" "%1"'
861         DetailPrint "removing default .$3 editor"
862         DeleteRegKey HKCR "$0\shell\edit\command"
863       ${EndIf}
865       ClearErrors
866       ReadRegStr $1 HKCR "$0\shell\open\command" ""
867       ${IfNotThen} ${Errors} ${|} DetailPrint "$3 viewer is $1" ${|}
868       ${If} $1 == '"$INSTDIR\Inkscape.exe" "%1"'
869         DetailPrint "removing default .$3 viewer"
870         DeleteRegKey HKCR "$0\shell\open\command"
871       ${EndIf}
873       DetailPrint "removing default .$3 context menu"
874       DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
875       DeleteRegKey /ifempty HKCR "$0\shell\edit"
876       DeleteRegKey /ifempty HKCR "$0\shell\open"
877       DeleteRegKey /ifempty HKCR "$0\shell"
878       DeleteRegKey /ifempty HKCR "$0"
880       ClearErrors
881       ReadRegStr $1 HKCR $0 ""
882       ${If} ${Errors} ; Formerly ${If} $1 == ""
883         DetailPrint "removing filetype .$3 $0"
884         DeleteRegKey HKCR ".$3"
885       ${EndIf}
886     ${EndIf}
887   ${Next}
889   SetShellVarContext all
890   DetailPrint "removing product regkey"
891   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
892   DetailPrint "removing uninstall info"
893   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
894   DetailPrint "removing shortcuts"
895   Delete "$DESKTOP\Inkscape.lnk"
896   Delete "$QUICKLAUNCH\Inkscape.lnk"
897   Delete "$SMPROGRAMS\Inkscape.lnk"
898   ;just in case they are still there
899   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
900   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
901   RMDir  "$SMPROGRAMS\Inkscape"
903   SetShellVarContext current
904   DetailPrint "removing product regkey"
905   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
906   DetailPrint "removing uninstall info"
907   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
908   DetailPrint "removing shortcuts"
909   Delete "$DESKTOP\Inkscape.lnk"
910   Delete "$QUICKLAUNCH\Inkscape.lnk"
911   Delete "$SMPROGRAMS\Inkscape.lnk"
912   ;just in case they are still there
913   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
914   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
915   RMDir  "$SMPROGRAMS\Inkscape"
917   DetailPrint "removing uninstall info"
919   InitPluginsDir
920   SetPluginUnload manual
922   ClearErrors
923   FileOpen $0 $INSTDIR\uninstall.log r
924   ${If} ${Errors} ;else uninstallnotfound
925     MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
926   ${Else}
927     ${Do}
928       ClearErrors
929       FileRead $0 $1
930       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
931       ; cat the line into md5 and filename
932       StrLen $2 $1
933       ${IfThen} $2 <= 35 ${|} ${Continue} ${|}
934       StrCpy $3 $1 32
935       StrCpy $filename $1 $2-36 34 #remove trailing CR/LF
936       StrCpy $filename $filename -2
937       ; $3 = MD5 when installed, then deletion choice
938       ; $filename = file
939       ; $5 = MD5 now
940       ; $6 = "always"/"never" remove files touched by user
942       ${If} ${FileExists} $filename
943         ${If} $6 == "always"
944           StrCpy $3 2
945         ${Else}
946           md5dll::GetMD5File /NOUNLOAD $filename
947           Pop $5 ;md5 of file
948           ${If} $3 != $5
949           ${AndIf} $6 != "never"
950             ; the md5 sums does not match so we ask
951             messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "0,103" \
952               "$(lng_FileChanged)" "$(lng_Yes)" "$(lng_AlwaysYes)" "$(lng_No)" "$(lng_AlwaysNo)"
953             Pop $3
954             ${IfThen} $3 = 2 ${|} StrCpy $6 "always" ${|}
955             ${IfThen} $3 = 4 ${|} StrCpy $6 "never" ${|}
956           ${EndIf}
957         ${EndIf}
959         ${If} $3 = 1   ; yes
960         ${OrIf} $3 = 2 ; always
961           ; Remove File
962           ClearErrors
963           Delete $filename
964           ;now recursivly remove the path
965           ${Do}
966             ClearErrors
967             ${un.GetParent} $filename $filename
968             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
969             RMDir $filename
970             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
971           ${Loop}
972         ${EndIf}
973       ${EndIf} ; complaining there's no opening if
974     ${Loop}
975   ${EndIf}
976   FileClose $0
977   Delete "$INSTDIR\uninstall.log"
978   Delete "$INSTDIR\uninstall.exe"
979   ; remove empty directories
980   RMDir "$INSTDIR\data"
981   RMDir "$INSTDIR\doc"
982   RMDir "$INSTDIR\modules"
983   RMDir "$INSTDIR\plugins"
984   RMDir $INSTDIR
985   SetAutoClose false
986 !endif
987 SectionEnd