Code

d47322f4571455b7b585f84b10804caef33b5af0
[inkscape.git] / packaging / win32 / inkscape.nsi
1 ; Instructions for compilers {{{1
2 ; ==========================
3 ; This file generates the Inkscape installer, which is currently the
4 ; preferred deployment method on Windows.
5 ; 1. Install NSIS 2.46 or later on Windows (2.45 has a !searchparse bug
6 ;    which breaks it and earlier doesn't support Windows 7 properly, and
7 ;    cross-compilation probably won't work due to some !system magic)
8 ; 2. Compile Inkscape (http://wiki.inkscape.org/wiki/index.php/Win32Port)
9 ; 3. Compile this file with NSIS. There should be no need to set version
10 ;    numbers in this file as it gets them from the Bazaar branch info and
11 ;    ..\..\src\inkscape-version.cpp. However, if the version number comes
12 ;    out wrong or this script didn't compile properly then you can define
13 ;    INKSCAPE_VERSION by uncommenting the next line and setting the correct
14 ;    value:
15 ;      !define INKSCAPE_VERSION "0.48"
16 ;    If you ever need to do a second, third or Nth release of the build or
17 ;    of the installer, then change the RELEASE_REVISION value below:
18        !define RELEASE_REVISION 1
20 ; There should never be any need for packagers to touch anything below
21 ; this line.  That's my job - Chris Morgan
23 ; Installer code {{{1
24 ; Compression and admin requirement {{{2
25 SetCompressor /SOLID lzma
26 SetCompressorDictSize 32
27 RequestExecutionLevel admin
29 ; Include required files {{{2
30 !include RequireLatestNSIS.nsh
31 !include ifexist.nsh
32 !include VersionCompleteXXXX.nsh
33 !include LogicLib.nsh
34 !include Sections.nsh
36 ; Advanced Uninstall Log {{{3
37 ; We're abusing this script terribly and it's time to fix the broken uninstaller.
38 ; However, for the moment, this is what we're using.
39 !define INSTDIR_REG_ROOT HKLM
40 !define INSTDIR_REG_KEY "${UNINST_KEY}"
41 !include AdvUninstLog.nsh
42 !insertmacro INTERACTIVE_UNINSTALL
44 ; Initialise NSIS plug-ins {{{3
45 ; The plugins used are md5dll and messagebox
46 !addplugindir .
48 ; FileFunc bits and pieces {{{3
49 !include FileFunc.nsh
50 !insertmacro GetParameters
51 !insertmacro GetOptions
52 !insertmacro un.GetParent
54 ; User interface {{{3
55 !include MUI.nsh
56 ; MUI Configuration {{{4
57 !define MUI_ABORTWARNING
58 !define MUI_ICON ..\..\inkscape.ico
59 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
60 !define MUI_HEADERIMAGE
61 !define MUI_HEADERIMAGE_BITMAP header.bmp
62 !define MUI_WELCOMEFINISHPAGE_BITMAP welcomefinish.bmp
63 !define MUI_COMPONENTSPAGE_SMALLDESC
65 ; Pages {{{4
66 ; Installer pages {{{5
67 ; Welcome page {{{6
68 !insertmacro MUI_PAGE_WELCOME
69 ; License page {{{6
70 LicenseForceSelection off
71 ;!define MUI_LICENSEPAGE_RADIOBUTTONS
72 !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
73 !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LICENSE_BOTTOM_TEXT)"
74 !insertmacro MUI_PAGE_LICENSE ..\..\Copying
75 ; Components page {{{6
76 !insertmacro MUI_PAGE_COMPONENTS
77 ; InstType "$(Full)"
78 ; InstType "$(Optimal)"
79 ; InstType "$(Minimal)"
80 ; Directory page {{{6
81 !insertmacro MUI_PAGE_DIRECTORY
82 ; Instfiles page {{{6
83 !insertmacro MUI_PAGE_INSTFILES
84 ; Finish page {{{6
85 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
86 !insertmacro MUI_PAGE_FINISH
88 ; Uninstaller pages {{{5
89 !insertmacro MUI_UNPAGE_CONFIRM
90 UninstPage custom un.CustomPageUninstall
91 !insertmacro MUI_UNPAGE_INSTFILES
92 ShowUninstDetails hide
93 !insertmacro MUI_UNPAGE_FINISH
95 ; Localization {{{3
96 ; See also the "Languages sections" SectionGroup lower down.
97 !insertmacro MUI_RESERVEFILE_LANGDLL
98 ;TODO: check if `!insertmacro LANGFILE "English" "English"`-style lines are needed (don't think it should be due to MUI_LANGUAGE)
99 !echo `Loading language files...`
100 !verbose push
101 !verbose 3
102 !insertmacro MUI_LANGUAGE "English"
103 !insertmacro LANGFILE_INCLUDE "languages\English.nsh"
104 !macro INKLANGFILE _LANG
105   !insertmacro MUI_LANGUAGE "${_LANG}"
106   !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "languages\${_LANG}.nsh" "languages\English.nsh"
107 !macroend
108 !insertmacro INKLANGFILE Breton
109 !insertmacro INKLANGFILE Catalan
110 !insertmacro INKLANGFILE Czech
111 !insertmacro INKLANGFILE Finnish
112 !insertmacro INKLANGFILE French
113 !insertmacro INKLANGFILE Galician
114 !insertmacro INKLANGFILE German
115 !insertmacro INKLANGFILE Italian
116 !insertmacro INKLANGFILE Japanese
117 !insertmacro INKLANGFILE Polish
118 !insertmacro INKLANGFILE Russian
119 !insertmacro INKLANGFILE Slovak
120 !insertmacro INKLANGFILE Slovenian
121 !insertmacro INKLANGFILE Spanish
122 !insertmacro INKLANGFILE SimpChinese
123 !insertmacro INKLANGFILE TradChinese
124 !verbose pop
126 ReserveFile inkscape.nsi.uninstall
127 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
128 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
130 ; #######################################
131 ; SETTINGS
132 ; #######################################
134 ; Product details (version, name, registry keys etc.) {{{2
135 ; Find the version number in inkscape-version.cpp (e.g. 0.47+devel) {{{3
136 !ifndef INKSCAPE_VERSION
137   ; Official release format (no newlines)
138   !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `namespace Inkscape {  char const *version_string = "` INKSCAPE_VERSION ` r` BZR_REVISION `";  }`
139   !ifndef INKSCAPE_VERSION
140     ; Other format; sorry, it has to be done in two steps.
141     !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `char const *version_string = "` INKSCAPE_VERSION `";`
142     !searchparse /noerrors `${INKSCAPE_VERSION}` `` INKSCAPE_VERSION ` r` BZR_REVISION
143     !ifndef INKSCAPE_VERSION
144       !error "INKSCAPE_VERSION not defined and unable to get version number from ..\..\src\inkscape-version.cpp!"
145     !endif
146   !endif
147 !endif
148 !echo `Got version number from ..\..\src\inkscape-version.cpp: ${INKSCAPE_VERSION}`
149 !define FILENAME Inkscape-${INKSCAPE_VERSION}
150 !define BrandingText `Inkscape ${INKSCAPE_VERSION}`
152 ; Check for the Bazaar revision number for lp:inkscape {{{3
153 !if `${BZR_REVISION}` == ``
154   ${!ifexist} ..\..\.bzr\branch\last-revision
155     !searchparse /noerrors /file ..\..\.bzr\branch\last-revision "" BZR_REVISION " "
156     !if `${BZR_REVISION}` != ``
157       !define _FILENAME `${FILENAME}-r${BZR_REVISION}`
158       !undef FILENAME
159       !define FILENAME `${_FILENAME}`
160       !undef _FILENAME
161       !define _BrandingText `${BrandingText} r${BZR_REVISION}`
162       !undef BrandingText
163       !define BrandingText `${_BrandingText}`
164       !undef _BrandingText
165       !undef RELEASE_REVISION ; don't want the -1 on devel releases
166     !endif
167   !endif
168 !endif
170 ; Handle the installer revision number {{{3
171 !ifdef RELEASE_REVISION
172   !define _FILENAME ${FILENAME}-${RELEASE_REVISION}
173   !undef FILENAME
174   !define FILENAME ${_FILENAME}
175   !undef _FILENAME
176   !define _BrandingText `${BrandingText}, revision ${RELEASE_REVISION}`
177   !undef BrandingText
178   !define BrandingText `${_BrandingText}`
179   !undef _BrandingText
180 !endif
182 ; Complete X.X version numbers into X.X.X.X {{{3
183 !searchparse /noerrors ${INKSCAPE_VERSION} "" _TMP "+devel"
184 !if ${_TMP} != ${INKSCAPE_VERSION} ; If it's a devel build,
185   !if `${BZR_REVISION}` != `` ; and we have the bzr revision
186     !define VERSION_X.X.X.X_REVISION ${BZR_REVISION}
187   !endif
188 !endif
189 !ifndef VERSION_X.X.X.X_REVISION ; it wasn't a devel build or we didn't have the bzr revision
190   !ifdef RELEASE_REVISION
191     !define VERSION_X.X.X.X_REVISION ${RELEASE_REVISION}
192   !else
193     !define VERSION_X.X.X.X_REVISION 0
194   !endif
195 !endif
196 ${VersionCompleteXXXN} ${_TMP} VERSION_X.X.X.X ${VERSION_X.X.X.X_REVISION}
198 ; Product definitions {{{3
199 !define PRODUCT_NAME "Inkscape" ; TODO: fix up the language files to not use this and kill this line
200 !define INSTDIR_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
201 !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape"
202 ;!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.
203 !define _FILENAME ${FILENAME}.exe
204 !undef FILENAME
205 !define FILENAME ${_FILENAME}
206 !undef _FILENAME
208 ; Product information {{{3
209 Name              `Inkscape`
210 Caption           `Inkscape - $(CaptionDescription)`
211 BrandingText      `${BrandingText}`
212 OutFile           `${FILENAME}`
213 InstallDir        "$PROGRAMFILES\Inkscape"
214 InstallDirRegKey  HKLM "${INSTDIR_KEY}" ""
216 ; Version information {{{3
217 VIProductVersion ${VERSION_X.X.X.X}
218 VIAddVersionKey ProductName Inkscape
219 VIAddVersionKey Comments "Licensed under the GNU GPL"
220 VIAddVersionKey CompanyName inkscape.org
221 VIAddVersionKey LegalCopyright "© 2009 Inkscape"
222 VIAddVersionKey FileDescription Inkscape
223 VIAddVersionKey FileVersion ${VERSION_X.X.X.X}
224 VIAddVersionKey ProductVersion ${VERSION_X.X.X.X}
225 VIAddVersionKey InternalName Inkscape
227 ; Variables {{{2
228 Var askMultiUser
229 Var filename
230 Var MultiUser
231 Var User
232 Var CMDARGS
234 !macro delprefs ; Delete preferences (originally from VLC) {{{2
235   StrCpy $0 0
236   DetailPrint "Deleting personal preferences..."
237   DetailPrint "Finding all users..."
238   ${Do}
239   ; this will loop through all the logged users and "virtual" windows users
240   ; (it looks like users are only present in HKEY_USERS when they are logged in)
241     ClearErrors
242     EnumRegKey $1 HKU "" $0
243     ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
244     IntOp $0 $0 + 1
245     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
246     ${IfThen} $2 == "" ${|} ${Continue} ${|}
247     DetailPrint "Removing $2\Inkscape"
248     Delete $2\Inkscape\preferences.xml
249     Delete $2\Inkscape\extension-errors.log
250     RMDir  $2\Inkscape
251   ${Loop}
252 !macroend
254 ; Sections (these do the work) {{{2
256 Section -removeInkscape ; Hidden, mandatory section to clean a previous installation {{{
257 !ifndef DUMMYINSTALL
258   ;remove the old Inkscape shortcuts from the startmenu
259   ;just in case they are still there
260   SetShellVarContext current
261   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
262   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
263   RMDir   $SMPROGRAMS\Inkscape
264   Delete  $SMPROGRAMS\Inkscape.lnk
265   SetShellVarContext all
266   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
267   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
268   RMDir   $SMPROGRAMS\Inkscape
269   Delete  $SMPROGRAMS\Inkscape.lnk
270 !endif
271 SectionEnd ; -removeInkscape }}}
273 Section $(Core) SecCore ; Mandatory Inkscape core files section {{{
274   SectionIn 1 2 3 RO
275 !ifndef DUMMYINSTALL
276   DetailPrint "Installing Inkscape core files..."
277   SetOutPath $INSTDIR
278   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
279   SetOverwrite on
280   SetAutoClose false
282   File           /a    ..\..\inkscape\ink*.exe
283   File           /a    ..\..\inkscape\AUTHORS
284   File           /a    ..\..\inkscape\COPYING
285   File           /a    ..\..\inkscape\COPYING.LIB
286   File           /a    ..\..\inkscape\NEWS
287   File           /a    ..\..\inkscape\gspawn-win32-helper.exe
288   File           /a    ..\..\inkscape\gspawn-win32-helper-console.exe
289   File /nonfatal /a    ..\..\inkscape\HACKING.txt
290   File           /a    ..\..\inkscape\README
291   File /nonfatal /a    ..\..\inkscape\README.txt
292   File           /a    ..\..\inkscape\TRANSLATORS
293   File /nonfatal /a /r ..\..\inkscape\data
294   File /nonfatal /a /r ..\..\inkscape\doc
295   File /nonfatal /a /r ..\..\inkscape\plugins
296   File /nonfatal /a /r /x *.??*.???* /x examples /x tutorials ..\..\inkscape\share
297   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
298   ; this files are added because it slips through the filter
299   SetOutPath $INSTDIR\share\clipart
300   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
301   File /a ..\..\inkscape\share\clipart\inkscape.logo.svg
302   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
303   SetOutPath $INSTDIR\share\icons
304   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
305   File /a ..\..\inkscape\share\icons\inkscape.file.png
306   File /a ..\..\inkscape\share\icons\inkscape.file.svg
307   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
308   SetOutPath $INSTDIR\modules
309   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
310   File /nonfatal /a /r ..\..\inkscape\modules\*.*
311   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
312   SetOutPath $INSTDIR\python
313   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
314   File /nonfatal /a /r ..\..\inkscape\python\*.*
315   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
316 !endif
317 SectionEnd ; SecCore }}}
319 Section $(GTKFiles) SecGTK ; Mandatory GTK files section {{{
320   SectionIn 1 2 3 RO
321 !ifndef DUMMYINSTALL
322   DetailPrint "Installing GTK files..."
323   SetOutPath $INSTDIR
324   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
325   SetOverwrite on
326   File /a /r ..\..\inkscape\*.dll
327   File /a /r /x locale ..\..\inkscape\lib
328   File /a /r ..\..\inkscape\etc
329   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
330 !endif
331 SectionEnd ; SecGTK }}}
333 Section -SetCurrentUserOnly ; Set the installation to "current user" only by default {{{
334 !ifndef DUMMYINSTALL
335   StrCpy $MultiUser 0
336   SetShellVarContext current
337 !endif
338 SectionEnd ; -SetCurrentUserOnly }}}
340 Section $(Alluser) SecAlluser ; Then offer the user the option to make it global (default) {{{
341   SectionIn 1 2 3
342 !ifndef DUMMYINSTALL
343   ; disable this option in Win95/Win98/WinME
344   StrCpy $MultiUser 1
345   DetailPrint "Installing in administrator mode (registry root will be HKLM)"
346   SetShellVarContext all
347 !endif
348 SectionEnd ; SecAllUser }}}
350 SectionGroup "$(Shortcuts)" SecShortcuts ; Create shortcuts for the user {{{
352 Section $(Desktop) SecDesktop ; Desktop shortcut {{{
353 !ifndef DUMMYINSTALL
354   CreateShortCut $DESKTOP\Inkscape.lnk $INSTDIR\inkscape.exe
355 !endif
356 SectionEnd ; SecDesktop }}}
358 Section $(Quicklaunch) SecQuickLaunch ; Quick Launch shortcut {{{
359 !ifndef DUMMYINSTALL
360   ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut $QUICKLAUNCH\Inkscape.lnk $INSTDIR\inkscape.exe ${|}
361 !endif
362 SectionEnd ; SecQuickLaunch }}}
364 Section $(SVGWriter) SecSVGWriter ; Register Inkscape as the default application for .svg[z] {{{
365   SectionIn 1 2 3
366 !ifndef DUMMYINSTALL
367   DetailPrint "Associating SVG files with Inkscape"
368   StrCpy $3 svg
369   ${For} $2 0 1
370     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
371     ReadRegStr $0 HKCR ".$3" ""
372     ${If} $0 == ""
373       StrCpy $0 "$3file"
374       WriteRegStr HKCR ".$3" "" $0
375       WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
376     ${EndIf}
377     WriteRegStr HKCR $0\shell\edit\command "" `"$INSTDIR\Inkscape.exe" "%1"`
378   ${Next}
379 !endif
380 SectionEnd ; SecSVGWriter }}}
382 Section $(ContextMenu) SecContextMenu ; Put Inkscape in the .svg[z] context menus (but not as default) {{{
383   SectionIn 1 2 3
384 !ifndef DUMMYINSTALL
385   DetailPrint "Adding Inkscape to SVG file context menu"
386   ReadRegStr $0 HKCR .svg ""
387   ${If} $0 == ""
388     StrCpy $0 svgfile
389     WriteRegStr HKCR .svg "" $0
390     WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
391   ${EndIf}
392   WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"`
394   ReadRegStr $0 HKCR .svgz ""
395   ${If} $0 == ""
396     StrCpy $0 svgzfile
397     WriteRegStr HKCR .svgz "" $0
398     WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
399   ${EndIf}
400   WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"`
401 !endif
402 SectionEnd ; SecContextMenu }}}
404 SectionGroupEnd ; SecShortcuts }}}
406 Section /o "$(DeletePrefs)" SecPrefs ; Delete user preferences before installation {{{
407 !ifndef DUMMYINSTALL
408   !insertmacro delprefs
409 !endif
410 SectionEnd ; SecPrefs }}}
412 SectionGroup "$(Addfiles)" SecAddfiles ; Additional files {{{
414 Section $(Examples) SecExamples ; Install example SVG files {{{
415   SectionIn 1 2
416 !ifndef DUMMYINSTALL
417   SetOutPath $INSTDIR\share
418   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
419   File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\examples
420   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
421 !endif
422 SectionEnd ; SecExamples }}}
424 Section $(Tutorials) SecTutorials ; Install tutorials {{{
425   SectionIn 1 2
426 !ifndef DUMMYINSTALL
427   SetOutPath $INSTDIR\share
428   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
429   File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\tutorials
430   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
431 !endif
432 SectionEnd ; SecTutorials }}}
434 SectionGroupEnd ; SecAddfiles }}}
436 SectionGroup "$(Languages)" SecLanguages ; Languages sections {{{
437   !macro Language SecName lng ; A macro to create each section {{{
438     Section /o "$(lng_${lng}) (${lng})" Sec${SecName}
439       ;SectionIn 1 2 3
440     !ifndef DUMMYINSTALL
441       SetOutPath $INSTDIR
442       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
443       File /nonfatal /a ..\..\inkscape\*.${lng}.txt ; FIXME: remove this?  No such files.
444       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
445       SetOutPath $INSTDIR\locale
446       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
447       File /nonfatal /a /r ..\..\inkscape\locale\${lng}
448       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
449       SetOutPath $INSTDIR\lib\locale
450       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
451       File /nonfatal /a /r ..\..\inkscape\lib\locale\${lng}
452       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
453       SetOutPath $INSTDIR\share\clipart
454       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
455       File /nonfatal /a /r ..\..\inkscape\share\clipart\*.${lng}.svg
456       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
457       ; the keyboard tables
458       SetOutPath $INSTDIR\share\screens
459       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
460       File /nonfatal /a /r ..\..\inkscape\share\screens\*.${lng}.svg
461       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
462       SetOutPath $INSTDIR\share\templates
463       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
464       File /nonfatal /a /r ..\..\inkscape\share\templates\*.${lng}.svg
465       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
466       SetOutPath $INSTDIR\doc
467       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
468       File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.xml
469       File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.html
470       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
471       SectionGetFlags ${SecTutorials} $R1
472       IntOp $R1 $R1 & ${SF_SELECTED}
473       ${If} $R1 >= ${SF_SELECTED}
474         SetOutPath $INSTDIR\share\tutorials
475         !insertmacro UNINSTALL.LOG_OPEN_INSTALL
476         File /nonfatal /a ..\..\inkscape\share\tutorials\*.${lng}.*
477         !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
478       ${EndIf}
479     !endif
480     SectionEnd
481   !macroend ; Language }}}
483   ; Now create each section with the Language macro {{{
484   !insertmacro Language Amharic           am
485   !insertmacro Language Arabic            ar
486   !insertmacro Language Azerbaijani       az
487   !insertmacro Language Byelorussian      be
488   !insertmacro Language Bulgarian         bg
489   !insertmacro Language Bengali           bn
490   !insertmacro Language Breton            br
491   !insertmacro Language Catalan           ca
492   !insertmacro Language CatalanValencia   ca@valencia
493   !insertmacro Language Czech             cs
494   !insertmacro Language Danish            da
495   !insertmacro Language German            de
496   !insertmacro Language Dzongkha          dz
497   !insertmacro Language Greek             el
498   !insertmacro Language EnglishAustralian en_AU
499   !insertmacro Language EnglishCanadian   en_CA
500   !insertmacro Language EnglishBritain    en_GB
501   !insertmacro Language EnglishPiglatin   en_US@piglatin
502   !insertmacro Language Esperanto         eo
503   !insertmacro Language Spanish           es
504   !insertmacro Language SpanishMexico     es_MX
505   !insertmacro Language Estonian          et
506   !insertmacro Language Basque            eu
507   !insertmacro Language French            fr
508   !insertmacro Language Finnish           fi
509   !insertmacro Language Irish             ga
510   !insertmacro Language Gallegan          gl
511   !insertmacro Language Hebrew            he
512   !insertmacro Language Croatian          hr
513   !insertmacro Language Hungarian         hu
514   !insertmacro Language Indonesian        id
515   !insertmacro Language Italian           it
516   !insertmacro Language Japanese          ja
517   !insertmacro Language Khmer             km
518   !insertmacro Language Korean            ko
519   !insertmacro Language Lithuanian        lt
520   !insertmacro Language Mongolian         mn
521   !insertmacro Language Macedonian        mk
522   !insertmacro Language NorwegianBokmal   nb
523   !insertmacro Language Nepali            ne
524   !insertmacro Language Dutch             nl
525   !insertmacro Language NorwegianNynorsk  nn
526   !insertmacro Language Panjabi           pa
527   !insertmacro Language Polish            pl
528   !insertmacro Language Portuguese        pt
529   !insertmacro Language PortugueseBrazil  pt_BR
530   !insertmacro Language Romanian          ro
531   !insertmacro Language Russian           ru
532   !insertmacro Language Kinyarwanda       rw
533   !insertmacro Language Slovak            sk
534   !insertmacro Language Slovenian         sl
535   !insertmacro Language Albanian          sq
536   !insertmacro Language Serbian           sr
537   !insertmacro Language SerbianLatin      sr@latin
538   !insertmacro Language Swedish           sv
539   !insertmacro Language Thai              th
540   !insertmacro Language Turkish           tr
541   !insertmacro Language Ukrainian         uk
542   !insertmacro Language Vietnamese        vi
543   !insertmacro Language ChineseSimplified zh_CN
544   !insertmacro Language ChineseTaiwan     zh_TW
545   ; }}}
546 SectionGroupEnd ; SecLanguages }}}
548 Section -FinalizeInstallation ; Hidden, mandatory section to finalize installation {{{
549 !ifndef DUMMYINSTALL
550   DetailPrint "Finalizing installation"
551   ${IfThen} $MultiUser  = 1 ${|} SetShellVarContext all ${|}
552   ${IfThen} $MultiUser != 1 ${|} SetShellVarContext current ${|}
554   WriteRegStr SHCTX "${INSTDIR_KEY}" ""           $INSTDIR\inkscape.exe
555   WriteRegStr SHCTX "${INSTDIR_KEY}" MultiUser    $MultiUser
556   WriteRegStr SHCTX "${INSTDIR_KEY}" askMultiUser $askMultiUser
557   WriteRegStr SHCTX "${INSTDIR_KEY}" User         $User
559   ; start menu entries
560   CreateShortcut $SMPROGRAMS\Inkscape.lnk $INSTDIR\inkscape.exe
562   ; uninstall settings
563   ; WriteUninstaller $INSTDIR\uninst.exe
564   WriteRegExpandStr SHCTX "${UNINST_KEY}" UninstallString ${UNINST_EXE}
565   WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallDir      $INSTDIR
566   WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallLocation $INSTDIR
567   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayName     "Inkscape ${INKSCAPE_VERSION}"
568   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayIcon     $INSTDIR\Inkscape.exe,0
569   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayVersion  ${INKSCAPE_VERSION}
570   WriteRegDWORD     SHCTX "${UNINST_KEY}" NoModify        1
571   WriteRegDWORD     SHCTX "${UNINST_KEY}" NoRepair        1
573   ;create/update log always within .onInstSuccess function
574   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
576   DetailPrint "Creating MD5 checksums"
577   ClearErrors
578   FileOpen $0 $INSTDIR\Uninstall.dat r
579   FileOpen $9 $INSTDIR\Uninstall.log w
580   ${IfNot} ${Errors}
581     ${Do}
582       ClearErrors
583       FileRead $0 $1
584       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
585       StrCpy $1 $1 -2
586       md5dll::GetMD5File /NOUNLOAD $1
587       Pop $2
588       ${IfThen} $2 != "" ${|} FileWrite $9 "$2  $1$\r$\n" ${|}
589     ${Loop}
590   ${EndIf}
591   FileClose $0
592   FileClose $9
593   ; Not needed any more
594   Delete $INSTDIR\Uninstall.dat
595 !endif
596 SectionEnd ; -FinalizeInstallation }}}
598 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN ; Section descriptions {{{
599   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(CoreDesc)"
600   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} "$(GTKFilesDesc)"
601   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "$(ShortcutsDesc)"
602   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} "$(AlluserDesc)"
603   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(DesktopDesc)"
604   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} "$(QuicklaunchDesc)"
605   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} "$(SVGWriterDesc)"
606   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} "$(ContextMenuDesc)"
607   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} "$(DeletePrefsDesc)"
608   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} "$(AddfilesDesc)"
609   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} "$(ExamplesDesc)"
610   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} "$(TutorialsDesc)"
611   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} "$(LanguagesDesc)"
612 !insertmacro MUI_FUNCTION_DESCRIPTION_END ; Section descriptions }}}
615 Function .onInit ; initialise the installer {{{2
616   ; This code will be executed before the sections, but due to the
617   ; language code in the sections it must come after it in the code.
619   ; Language detection {{{
620   !insertmacro MUI_LANGDLL_DISPLAY
622   !macro LanguageAutoSelect SecName LocaleID
623     ${If} $LANGUAGE = ${LocaleID}
624       SectionGetFlags ${Sec${SecName}} $0
625       IntOp $0 $0 | ${SF_SELECTED}
626       SectionSetFlags ${Sec${SecName}} $0
627     ${EndIf}
628   !macroend
630   ; No need for English to be detected as it's the default
631   !insertmacro LanguageAutoSelect Breton        1150
632   !insertmacro LanguageAutoSelect Catalan       1027
633   !insertmacro LanguageAutoSelect Czech         1029
634   !insertmacro LanguageAutoSelect Finnish       1035
635   !insertmacro LanguageAutoSelect French        1036
636   !insertmacro LanguageAutoSelect Gallegan      1110 ; Galician, but section is called Gallegan
637   !insertmacro LanguageAutoSelect German        1031
638   !insertmacro LanguageAutoSelect Italian       1040
639   !insertmacro LanguageAutoSelect Japanese      1041
640   !insertmacro LanguageAutoSelect Polish        1045
641   !insertmacro LanguageAutoSelect Russian       1049
642   !insertmacro LanguageAutoSelect Slovak        1051
643   !insertmacro LanguageAutoSelect Slovenian     1060
644   !insertmacro LanguageAutoSelect Spanish       1034
645   !insertmacro LanguageAutoSelect ChineseTaiwan 1028 ; TradChinese, but section is called ChineseTaiwan
646   ; End of language detection }}}
648   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL ; prepare advanced uninstallation log script
650   ;Extract InstallOptions INI files
651   StrCpy $AskMultiUser 1
652   StrCpy $MultiUser 0
653   ; this resets AskMultiUser if Win95/98/ME
654   ClearErrors
655   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
656   ${If} ${Errors}
657     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
658     StrCpy $R0 $R0 1
659     ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|}
660   ${EndIf}
662   ; hide all user section if ME/9x
663   ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|}
665   ; hide if quick launch if not available
666   ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|}
668   ; Check for administrative privileges {{{
669   ClearErrors
670   UserInfo::GetName
671   ${If} ${Errors}
672     ; This one means you don't need to care about admin or
673     ; not admin because Windows 9x doesn't either
674     ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NOT_SUPPORTED)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|}
675   ${Else}
676     Pop $User
677     UserInfo::GetAccountType
678     Pop $1
679     ${If} $1 != Admin
680     ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NO_ADMIN)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
681       Quit
682     ${EndIf}
683   ${EndIf} ; }}}
685   ; Detect an Inkscape installation by another user {{{
686   ReadRegStr $0 HKLM "${INSTDIR_KEY}" User                              ; first global...
687   ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${INSTDIR_KEY}" User ${|} ; then current user
688   ${If} $0 != ""
689   ${AndIf} $0 != $User
690   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
691     Quit
692   ${EndIf} ; }}}
694   ; Request uninstallation of an old Inkscape installation {{{
695   ReadRegStr $R0 HKLM "${UNINST_KEY}" UninstallString
696   ${IfThen} $R0 == "" ${|} ReadRegStr $R0 HKCU "${UNINST_KEY}" UninstallString ${|}
697   ${If} $R0 != ""
698   ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WANT_UNINSTALL_BEFORE)" /SD IDNO IDYES ${|}
699     ExecWait $R0
700   ${EndIf} ; }}}
702   ; Process command-line arguments (for automation) {{{
703   !echo `Creating code to process command-line arguments...`
704   !verbose push
705   !verbose 3
706   ${GetParameters} $CMDARGS
708   !macro Parameter key Section
709     ${GetOptions} $CMDARGS /${key}= $1
710     ${If} $1 == OFF
711       SectionGetFlags ${Section} $0
712       IntOp $2 ${SF_SELECTED} ~
713       IntOp $0 $0 & $2
714       SectionSetFlags ${Section} $0
715     ${EndIf}
716     ${If} $1 == ON
717       SectionGetFlags ${Section} $0
718       IntOp $0 $0 | ${SF_SELECTED}
719       SectionSetFlags ${Section} $0
720     ${EndIf}
721   !macroend
723   !insertmacro Parameter GTK            ${SecGTK}
724   !insertmacro Parameter SHORTCUTS      ${secShortcuts}
725   !insertmacro Parameter ALLUSER        ${SecAlluser}
726   !insertmacro Parameter DESKTOP        ${SecDesktop}
727   !insertmacro Parameter QUICKLAUNCH    ${SecQUICKlaunch}
728   !insertmacro Parameter SVGEDITOR      ${SecSVGWriter}
729   !insertmacro Parameter CONTEXTMENUE   ${SecContextMenu}
730   !insertmacro Parameter PREFERENCES    ${SecPrefs}
731   !insertmacro Parameter ADDFILES       ${SecAddfiles}
732   !insertmacro Parameter EXAMPLES       ${SecExamples}
733   !insertmacro Parameter TUTORIALS      ${SecTutorials}
734   !insertmacro Parameter LANGUAGES      ${SecLanguages}
735   !insertmacro Parameter am             ${SecAmharic}
736   !insertmacro Parameter ar             ${SecArabic}
737   !insertmacro Parameter az             ${SecAzerbaijani}
738   !insertmacro Parameter be             ${SecByelorussian}
739   !insertmacro Parameter bg             ${SecBulgarian}
740   !insertmacro Parameter bn             ${SecBengali}
741   !insertmacro Parameter br             ${SecBreton}
742   !insertmacro Parameter ca             ${SecCatalan}
743   !insertmacro Parameter ca@valencia    ${SecCatalanValencia}
744   !insertmacro Parameter cs             ${SecCzech}
745   !insertmacro Parameter da             ${SecDanish}
746   !insertmacro Parameter de             ${SecGerman}
747   !insertmacro Parameter dz             ${SecDzongkha}
748   !insertmacro Parameter el             ${SecGreek}
749   !insertmacro Parameter en_AU          ${SecEnglishAustralian}
750   !insertmacro Parameter en_CA          ${SecEnglishCanadian}
751   !insertmacro Parameter en_GB          ${SecEnglishBritain}
752   !insertmacro Parameter en_US@piglatin ${SecEnglishPiglatin}
753   !insertmacro Parameter eo             ${SecEsperanto}
754   !insertmacro Parameter es             ${SecSpanish}
755   !insertmacro Parameter es_MX          ${SecSpanishMexico}
756   !insertmacro Parameter et             ${SecEstonian}
757   !insertmacro Parameter eu             ${SecBasque}
758   !insertmacro Parameter fi             ${SecFinnish}
759   !insertmacro Parameter fr             ${SecFrench}
760   !insertmacro Parameter ga             ${SecIrish}
761   !insertmacro Parameter gl             ${SecGallegan}
762   !insertmacro Parameter he             ${SecHebrew}
763   !insertmacro Parameter hr             ${SecCroatian}
764   !insertmacro Parameter hu             ${SecHungarian}
765   !insertmacro Parameter id             ${SecIndonesian}
766   !insertmacro Parameter it             ${SecItalian}
767   !insertmacro Parameter ja             ${SecJapanese}
768   !insertmacro Parameter km             ${SecKhmer}
769   !insertmacro Parameter ko             ${SecKorean}
770   !insertmacro Parameter lt             ${SecLithuanian}
771   !insertmacro Parameter mk             ${SecMacedonian}
772   !insertmacro Parameter mn             ${SecMongolian}
773   !insertmacro Parameter nb             ${SecNorwegianBokmal}
774   !insertmacro Parameter ne             ${SecNepali}
775   !insertmacro Parameter nl             ${SecDutch}
776   !insertmacro Parameter nn             ${SecNorwegianNynorsk}
777   !insertmacro Parameter pa             ${SecPanjabi}
778   !insertmacro Parameter pl             ${SecPolish}
779   !insertmacro Parameter pt             ${SecPortuguese}
780   !insertmacro Parameter pt_BR          ${SecPortugueseBrazil}
781   !insertmacro Parameter ro             ${SecRomanian}
782   !insertmacro Parameter ru             ${SecRussian}
783   !insertmacro Parameter rw             ${SecKinyarwanda}
784   !insertmacro Parameter sk             ${SecSlovak}
785   !insertmacro Parameter sl             ${SecSlovenian}
786   !insertmacro Parameter sq             ${SecAlbanian}
787   !insertmacro Parameter sr             ${SecSerbian}
788   !insertmacro Parameter sr@latin       ${SecSerbianLatin}
789   !insertmacro Parameter sv             ${SecSwedish}
790   !insertmacro Parameter th             ${SecThai}
791   !insertmacro Parameter tr             ${SecTurkish}
792   !insertmacro Parameter uk             ${SecUkrainian}
793   !insertmacro Parameter vi             ${SecVietnamese}
794   !insertmacro Parameter zh_CN          ${SecChineseSimplified}
795   !insertmacro Parameter zh_TW          ${SecChineseTaiwan}
797   ClearErrors
798   ${GetOptions} $CMDARGS /? $1
799   ${IfNot} ${Errors}
800     MessageBox MB_OK "Possible parameters for installer:$\r$\n \
801       /?: this help screen$\r$\n \
802       /S: silent$\r$\n \
803       /D=(directory): where to install Inkscape$\r$\n \
804       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
805       /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \
806       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
807       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
808       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
809       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
810       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
811       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
812       /ADDFILES=(OFF/ON): additional files$\r$\n \
813       /EXAMPLES=(OFF/ON): examples$\r$\n \
814       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
815       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
816       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
817     Abort
818     !verbose pop
819   ${EndIf} ; }}}
820 FunctionEnd ; .onInit }}}
821 ; Uninstaller code {{{1
822 Function un.onInit ; initialise uninstaller {{{
823   ;begin uninstall, could be added on top of uninstall section instead
824   ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
825   ${IfNot} ${FileExists} $INSTDIR\uninstall.log
826     MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK
827     Quit
828   ${EndIf}
829   ClearErrors
830   StrCpy $User ""
831   UserInfo::GetName
832   ${IfNot} ${Errors}
833     Pop $0
834     StrCpy $User $0
835   ${EndIf}
836   StrCpy $askMultiUser 1
837   StrCpy $MultiUser 1
839   ; Test if this was a multiuser installation
840     ReadRegStr $0            HKLM "${INSTDIR_KEY}" ""
841   ${If} $0 == $INSTDIR\inkscape.exe
842     ReadRegStr $MultiUser    HKLM "${INSTDIR_KEY}" MultiUser
843     ReadRegStr $askMultiUser HKLM "${INSTDIR_KEY}" askMultiUser
844     ReadRegStr $0            HKLM "${INSTDIR_KEY}" User
845   ${Else}
846     ReadRegStr $MultiUser    HKCU "${INSTDIR_KEY}" MultiUser
847     ReadRegStr $askMultiUser HKCU "${INSTDIR_KEY}" askMultiUser
848     ReadRegStr $0            HKCU "${INSTDIR_KEY}" User
849   ${EndIf}
850   ;check user if applicable
851   ${If} $0 != ""
852   ${AndIf} $0 != $User
853   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
854     Quit
855   ${EndIf}
857   !insertmacro MUI_INSTALLOPTIONS_EXTRACT inkscape.nsi.uninstall
859   SetShellVarContext all
860   ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|}
861 FunctionEnd ; un.onInit }}}
863 Function un.CustomPageUninstall ; {{{
864   !insertmacro MUI_HEADER_TEXT "$(UInstOpt)" "$(UInstOpt1)"
865   !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 1" Text "$APPDATA\Inkscape\"
866   !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 2" Text "$(PurgePrefs)"
867   !insertmacro MUI_INSTALLOPTIONS_DISPLAY inkscape.nsi.uninstall
868   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser inkscape.nsi.uninstall "Field 2" State
869 FunctionEnd ; un.CustomPageUninstall }}}
871 Section Uninstall ; do the uninstalling {{{
872 !ifndef DUMMYINSTALL
873   ; remove personal settings
874   Delete $APPDATA\Inkscape\extension-errors.log
875   ${If} $MultiUser = 0
876     DetailPrint "Purging personal settings in $APPDATA\Inkscape"
877     ;RMDir /r $APPDATA\Inkscape
878     !insertmacro delprefs
879   ${EndIf}
881   ; Remove file associations for svg editor
882   StrCpy $3 svg
883   ${For} $2 0 1
884     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
885     DetailPrint "Removing file associations for $3 editor"
886     ClearErrors
887     ReadRegStr $0 HKCR .$3 ""
888     ${IfNot} ${Errors}
889       ReadRegStr $1 HKCR $0\shell\edit\command ""
890       ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
891         DeleteRegKey HKCR $0\shell\edit\command
892       ${EndIf}
894       ClearErrors
895       ReadRegStr $1 HKCR $0\shell\open\command ""
896       ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
897         DeleteRegKey HKCR $0\shell\open\command
898       ${EndIf}
900       DeleteRegKey HKCR $0\shell\Inkscape
901       DeleteRegKey /ifempty HKCR $0\shell\edit
902       DeleteRegKey /ifempty HKCR $0\shell\open
903       DeleteRegKey /ifempty HKCR $0\shell
904       DeleteRegKey /ifempty HKCR $0
905       DeleteRegKey /ifempty HKCR .$3
906     ${EndIf}
907   ${Next}
909   SetShellVarContext all
910   DeleteRegKey SHCTX "${INSTDIR_KEY}"
911   DeleteRegKey SHCTX "${UNINST_KEY}"
912   Delete $DESKTOP\Inkscape.lnk
913   Delete $QUICKLAUNCH\Inkscape.lnk
914   Delete $SMPROGRAMS\Inkscape.lnk
915   ;just in case they are still there
916   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
917   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
918   RMDir   $SMPROGRAMS\Inkscape
920   SetShellVarContext current
921   DeleteRegKey SHCTX "${INSTDIR_KEY}"
922   DeleteRegKey SHCTX "${UNINST_KEY}"
923   Delete $DESKTOP\Inkscape.lnk
924   Delete $QUICKLAUNCH\Inkscape.lnk
925   Delete $SMPROGRAMS\Inkscape.lnk
926   ;just in case they are still there
927   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
928   Delete $SMPROGRAMS\Inkscape\Inkscape.lnk
929   RMDir  $SMPROGRAMS\Inkscape
931   InitPluginsDir
932   SetPluginUnload manual
934   ClearErrors
935   FileOpen $0 $INSTDIR\uninstall.log r
936   ${If} ${Errors} ;else uninstallnotfound
937     MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK
938   ${Else}
939     ${Do}
940       ClearErrors
941       FileRead $0 $1
942       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
943       ; cat the line into md5 and filename
944       StrLen $2 $1
945       ${IfThen} $2 <= 35 ${|} ${Continue} ${|}
946       StrCpy $3 $1 32
947       StrCpy $filename $1 $2-36 34 ;remove trailing CR/LF
948       StrCpy $filename $filename -2
949       ; $3 = MD5 when installed, then deletion choice
950       ; $filename = file
951       ; $5 = MD5 now
952       ; $6 = always/never remove files touched by user
954       ${If} ${FileExists} $filename
955         ${If} $6 == always
956           StrCpy $3 2
957         ${Else}
958           md5dll::GetMD5File /NOUNLOAD $filename
959           Pop $5 ;md5 of file
960           ${If} $3 != $5
961           ${AndIf} $6 != never
962             ; the md5 sums does not match so we ask
963             messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" 0,103 \
964               "$(FileChanged)" "$(Yes)" "$(AlwaysYes)" "$(No)" "$(AlwaysNo)"
965             Pop $3
966             ${IfThen} $3 = 2 ${|} StrCpy $6 always ${|}
967             ${IfThen} $3 = 4 ${|} StrCpy $6 never ${|}
968           ${EndIf}
969         ${EndIf}
971         ${If}   $3 = 1 ; yes
972         ${OrIf} $3 = 2 ; always
973           ; Remove File
974           ClearErrors
975           Delete $filename
976           ;now recursivly remove the path
977           ${Do}
978             ClearErrors
979             ${un.GetParent} $filename $filename
980             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
981             RMDir $filename
982             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
983           ${Loop}
984         ${EndIf}
985       ${EndIf}
986     ${Loop}
987   ${EndIf}
988   FileClose $0
989   Delete $INSTDIR\uninstall.log
990   Delete $INSTDIR\uninstall.exe
991   ; remove empty directories
992   RMDir $INSTDIR\data
993   RMDir $INSTDIR\doc
994   RMDir $INSTDIR\modules
995   RMDir $INSTDIR\plugins
996   RMDir $INSTDIR
997   SetAutoClose false
998 !endif
999 SectionEnd ; Uninstall }}}
1000 ; }}}
1002 ; This file has been optimised for use in Vim with folding.
1003 ; (If you can't cope, :set nofoldenable) vim:foldenable