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