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