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