Code

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