Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 431 lines (378 sloc) 14.557 kb
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; geany.nsi - this file is part of Geany, a fast and lightweight IDE
3 ;
1c2c455b »
2012-06-18 Update copyright information
4 ; Copyright 2007-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 ; Copyright 2007-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
6 ;
7 ; This program is free software; you can redistribute it and/or modify
8 ; it under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation; either version 2 of the License, or
10 ; (at your option) any later version.
11 ;
12 ; This program is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
16 ;
17 ; You should have received a copy of the GNU General Public License
18 ; along with this program; if not, write to the Free Software
19 ; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 ;
21 ;
22 ; Installer script for Geany (Windows Installer)
23 ; (Script originally generated by the HM NIS Edit Script Wizard)
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25
26
27 ; Do a Cyclic Redundancy Check to make sure the installer was not corrupted by the download
28 CRCCheck force
593341ba »
2010-06-12 Change the RequestExecutionLevel for the Windows installer to 'highest'.
29 RequestExecutionLevel highest ; set execution level for Windows Vista
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
30
31 ;;;;;;;;;;;;;;;;;;;
32 ; helper defines ;
33 ;;;;;;;;;;;;;;;;;;;
34 !define PRODUCT_NAME "Geany"
e9d61aa7 »
2012-06-18 Post release version bump
35 !define PRODUCT_VERSION "1.23"
36 !define PRODUCT_VERSION_ID "1.23.0.0"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
37 !define PRODUCT_PUBLISHER "The Geany developer team"
f101e95a »
2008-09-01 New website address: www.geany.org.
38 !define PRODUCT_WEB_SITE "http://www.geany.org/"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
39 !define PRODUCT_DIR_REGKEY "Software\Geany"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
40 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
41 !define PRODUCT_EXE "$INSTDIR\bin\Geany.exe"
42 !define PRODUCT_REGNAME "Geany.ProjectFile"
43 !define PRODUCT_EXT ".geany"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
44 !define RESOURCEDIR "geany-${PRODUCT_VERSION}"
45
46 ;;;;;;;;;;;;;;;;;;;;;
47 ; Version resource ;
48 ;;;;;;;;;;;;;;;;;;;;;
49 VIProductVersion "${PRODUCT_VERSION_ID}"
50 VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
51 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
52 VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
1c2c455b »
2012-06-18 Update copyright information
53 VIAddVersionKey "LegalCopyright" "Copyright 2005-2012 by the Geany developer team"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
54 VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer"
55
593341ba »
2010-06-12 Change the RequestExecutionLevel for the Windows installer to 'highest'.
56 BrandingText "$(^NAME) installer (NSIS 2.46)"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
57 InstallDir "$PROGRAMFILES\Geany"
58 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
59 SetCompressor /SOLID lzma
60 ShowInstDetails hide
61 ShowUnInstDetails hide
62 XPStyle on
63 !ifdef INCLUDE_GTK
64 OutFile "geany-${PRODUCT_VERSION}_setup.exe"
65 !else
66 OutFile "geany-${PRODUCT_VERSION}_nogtk_setup.exe"
67 !endif
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
68
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
69 Var Answer
70 Var UserName
71 Var StartmenuFolder
72 Var UNINSTDIR
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
73
74 ;;;;;;;;;;;;;;;;
75 ; MUI Settings ;
76 ;;;;;;;;;;;;;;;;
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
77 !include "MUI2.nsh"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
78
79 !define MUI_ABORTWARNING
8abccc9b »
2009-05-26 Move the icons geany.png and geany.ico into the icons directory.
80 !define MUI_ICON "icons\geany.ico"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
81 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
82
83 ; Welcome page
84 !insertmacro MUI_PAGE_WELCOME
85 ; License page
86 ;!define MUI_LICENSEPAGE_RADIOBUTTONS
87 !insertmacro MUI_PAGE_LICENSE "${RESOURCEDIR}\Copying.txt"
88 ; Components page
89 !insertmacro MUI_PAGE_COMPONENTS
90 ; Directory page
91 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
92 !insertmacro MUI_PAGE_DIRECTORY
93 ; Start menu page
94 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Geany"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
95 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
96 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
97 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
98 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} "$StartmenuFolder"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
99 ; Instfiles page
100 !insertmacro MUI_PAGE_INSTFILES
101 ; Finish page
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
102 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\News.txt"
103 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show Release Notes"
104 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
a600f6bb »
2008-08-17 Put geany.exe into a 'bin' subdirectory as well as the included
105 !define MUI_FINISHPAGE_RUN "$INSTDIR\bin\Geany.exe"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
106 !define MUI_FINISHPAGE_RUN_NOTCHECKED
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
107 !insertmacro MUI_PAGE_FINISH
108
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
109 !insertmacro MUI_UNPAGE_INSTFILES ; Uninstaller page
110 !insertmacro MUI_LANGUAGE "English" ; Language file
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
111
112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
113 ; Sections and InstTypes ;
114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
115 InstType "Full"
116 InstType "Minimal"
117
118 Section "!Program Files" SEC01
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
119 SectionIn RO 1 2
120 SetOverwrite ifnewer
121
122 SetOutPath "$INSTDIR"
123 File "${RESOURCEDIR}\*.txt"
124
125 SetOutPath "$INSTDIR\bin"
126 File "${RESOURCEDIR}\bin\Geany.exe"
127
128 SetOutPath "$INSTDIR\data"
129 File "${RESOURCEDIR}\data\GPL-2"
130 File "${RESOURCEDIR}\data\file*"
920fe578 »
2012-06-19 Add missing files in the Windows installer
131 File "${RESOURCEDIR}\data\geany.glade"
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
132 File "${RESOURCEDIR}\data\snippets.conf"
133 File "${RESOURCEDIR}\data\ui_toolbar.xml"
134
b264ba61 »
2010-07-25 Fix missing template files in the Windows installer.
135 SetOutPath "$INSTDIR\data\templates"
136 File /r "${RESOURCEDIR}\data\templates\*"
137
920fe578 »
2012-06-19 Add missing files in the Windows installer
138 SetOutPath "$INSTDIR\data\colorschemes"
139 File /r "${RESOURCEDIR}\data\colorschemes\*"
140
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
141 SetOutPath "$INSTDIR\share\icons"
142 File /r "${RESOURCEDIR}\share\icons\*"
143
144 SetOutPath "$INSTDIR"
145
146 CreateShortCut "$INSTDIR\Geany.lnk" "$INSTDIR\bin\Geany.exe"
147 !insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
148 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
149 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Geany.lnk" "$INSTDIR\bin\Geany.exe"
150 !insertmacro MUI_STARTMENU_WRITE_END
151
152 ; register the extension .geany
153 ; write information about file type
154 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}" "" "${PRODUCT_NAME} Project File"
155 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\DefaultIcon" "" "${PRODUCT_EXE},0"
156 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${PRODUCT_EXE}" "%1"'
157 ; write information about file extensions
158 WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "" "${PRODUCT_REGNAME}"
159 ; refresh shell
160 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) (0x08000000, 0, 0, 0)'
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
161 SectionEnd
162
163 Section "Plugins" SEC02
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
164 SectionIn 1
165 SetOverwrite ifnewer
166 SetOutPath "$INSTDIR\lib"
167 File "${RESOURCEDIR}\lib\*.dll"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
168 SectionEnd
169
170 Section "Language Files" SEC03
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
171 SectionIn 1
172 SetOutPath "$INSTDIR\share\locale"
173 File /r "${RESOURCEDIR}\share\locale\*"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
174 !ifdef INCLUDE_GTK
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
175 SetOutPath "$INSTDIR\share"
176 File /r "gtk\share\*"
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
177 !endif
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
178 SectionEnd
179
180 Section "Documentation" SEC04
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
181 SectionIn 1
182 SetOverwrite ifnewer
183 SetOutPath "$INSTDIR"
184 File /r "${RESOURCEDIR}\doc"
185 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" "$INSTDIR\doc\Manual.html"
186 !insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
187 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Documentation.lnk" "$INSTDIR\Documentation.url"
188 !insertmacro MUI_STARTMENU_WRITE_END
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
189 SectionEnd
190
191 Section "Autocompletion Tags" SEC05
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
192 SectionIn 1
193 SetOutPath "$INSTDIR\data"
194 SetOverwrite ifnewer
195 File "${RESOURCEDIR}\data\php.tags"
196 File "${RESOURCEDIR}\data\pascal.tags"
197 File "${RESOURCEDIR}\data\python.tags"
198 File "${RESOURCEDIR}\data\html_entities.tags"
a47b682f »
2009-01-17 Remove GTK tags (data/global.tags).
199 File "${RESOURCEDIR}\data\c99.tags"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
200 SectionEnd
201
202 ; Include GTK runtime library but only if desired from command line
203 !ifdef INCLUDE_GTK
f8864c57 »
2010-03-20 Remove reference to already removed latex.tags file. Future releases …
204 Section "GTK 2.16 Runtime Environment" SEC06
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
205 SectionIn 1
206 SetOverwrite ifnewer
207 SetOutPath "$INSTDIR\bin"
208 File /r "gtk\bin\*"
209 SetOutPath "$INSTDIR\etc"
210 File /r "gtk\etc\*"
211 SetOutPath "$INSTDIR\lib"
212 File /r "gtk\lib\*"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
213 SectionEnd
214 !endif
215
11ae9838 »
2008-10-15 Add option to not create desktop and quicklaunch shortcuts. Allow ski…
216 Section "Context Menus" SEC07
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
217 SectionIn 1
218 WriteRegStr HKCR "*\shell\OpenWithGeany" "" "Open with Geany"
ddd095d7 »
2009-06-20 Quote the full filename to the Geany executable when creating the "Op…
219 WriteRegStr HKCR "*\shell\OpenWithGeany\command" "" '"$INSTDIR\bin\geany.exe" "%1"'
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
220 SectionEnd
221
11ae9838 »
2008-10-15 Add option to not create desktop and quicklaunch shortcuts. Allow ski…
222 Section "Desktop Shortcuts" SEC08
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
223 SectionIn 1
224 CreateShortCut "$DESKTOP\Geany.lnk" "$INSTDIR\bin\Geany.exe"
225 CreateShortCut "$QUICKLAUNCH\Geany.lnk" "$INSTDIR\bin\Geany.exe"
11ae9838 »
2008-10-15 Add option to not create desktop and quicklaunch shortcuts. Allow ski…
226 SectionEnd
227
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
228 Section -AdditionalIcons
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
229 SetOutPath $INSTDIR
230 !insertmacro MUI_STARTMENU_WRITE_BEGIN ${PRODUCT_NAME}
231 WriteIniStr "$INSTDIR\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
232 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Website.lnk" "$INSTDIR\Website.url"
233 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "$INSTDIR\uninst.exe"
234 !insertmacro MUI_STARTMENU_WRITE_END
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
235 SectionEnd
236
237 Section -Post
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
238 WriteUninstaller "$INSTDIR\uninst.exe"
239 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" Path "$INSTDIR"
240 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
241 ${if} $Answer == "yes" ; if user is admin
242 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
243 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
244 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\Geany.exe"
245 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
246 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
247 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}"
248 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
249 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
250 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
251 ${endif}
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
252 SectionEnd
253
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
254 Section Uninstall
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
255 Delete "$INSTDIR\Website.url"
256 Delete "$INSTDIR\Documentation.url"
257 Delete "$INSTDIR\uninst.exe"
258 Delete "$INSTDIR\News.txt"
259 Delete "$INSTDIR\ReadMe.txt"
260 Delete "$INSTDIR\Thanks.txt"
261 Delete "$INSTDIR\ToDo.txt"
262 Delete "$INSTDIR\Authors.txt"
263 Delete "$INSTDIR\ChangeLog.txt"
264 Delete "$INSTDIR\Copying.txt"
265 Delete "$INSTDIR\Geany.lnk"
266
267 ; delete start menu entry
268 ReadRegStr $0 SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu"
269 RMDir /r "$0"
270
271 Delete "$QUICKLAUNCH\Geany.lnk"
272 Delete "$DESKTOP\Geany.lnk"
273
274 RMDir /r "$INSTDIR\bin"
275 RMDir /r "$INSTDIR\doc"
276 RMDir /r "$INSTDIR\data"
277 RMDir /r "$INSTDIR\etc"
278 RMDir /r "$INSTDIR\lib"
279 RMDir /r "$INSTDIR\share"
280 RMDir "$INSTDIR"
281
282 ; remove .geany file extension
283 ReadRegStr $R0 SHCTX "Software\Classes\${PRODUCT_EXT}" ""
284 ${if} $R0 == "${PRODUCT_REGNAME}"
285 DeleteRegKey SHCTX "${PRODUCT_EXT}"
286 DeleteRegKey HKCR "${PRODUCT_EXT}"
287 DeleteRegKey SHCTX "${PRODUCT_REGNAME}"
288 DeleteRegKey HKCR "${PRODUCT_REGNAME}"
289 ${endif}
290
291 DeleteRegKey HKCR "*\shell\OpenWithGeany"
292
293 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
294 DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
295 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
296 DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
297
298 SetAutoClose true
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
299 SectionEnd
79a882b0 »
2008-01-23 Fix created documentation shortcut in the Start Menu. Fixes for bundl…
300
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
301 ;;;;;;;;;;;;;;;;;;;;;;;;;
302 ; Section descriptions ;
303 ;;;;;;;;;;;;;;;;;;;;;;;;;
304 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
305 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Required program files. You cannot skip these files."
306 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Available plugins like 'Version Diff', 'Class Builder' and 'Insert Special Characters'."
307 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Various translations of Geany's interface."
308 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Manual in Text and HTML format."
309 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Symbol lists necessary for auto completion of symbols."
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
310 !ifdef INCLUDE_GTK
f8864c57 »
2010-03-20 Remove reference to already removed latex.tags file. Future releases …
311 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "You need these files to run Geany. If you have already installed a GTK Runtime Environment (2.16 or higher), you can skip it."
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
312 !endif
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
313 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "Add context menu item 'Open With Geany'"
314 !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} "Create shortcuts for Geany on the desktop and in the Quicklaunch Bar"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
315 !insertmacro MUI_FUNCTION_DESCRIPTION_END
316
317 ;;;;;;;;;;;;;;;;;;;;;
318 ; helper functions ;
319 ;;;;;;;;;;;;;;;;;;;;;
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
320
321 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
322 !macro IsUserAdmin Result UName
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
323 ClearErrors
324 UserInfo::GetName
325 IfErrors Win9x
326 Pop $0
327 StrCpy ${UName} $0
328 UserInfo::GetAccountType
329 Pop $1
330 ${if} $1 == "Admin"
331 StrCpy ${Result} "yes"
332 ${else}
333 StrCpy ${Result} "no"
334 ${endif}
335 Goto done
336
337 Win9x:
338 StrCpy ${Result} "yes"
339 done:
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
340 !macroend
341
342 Function .onInit
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
343 StrCpy "$StartmenuFolder" "Geany"
344
345 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
346 ; If the user does *not* have administrator privileges, abort
347 StrCpy $Answer ""
348 StrCpy $UserName ""
349 !insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
350 ${if} $Answer == "yes"
351 SetShellVarContext all ; set that e.g. shortcuts will be created for all users
352 ${else}
353 SetShellVarContext current
354 ; TODO is this really what we want? $PROGRAMFILES is not much better because
355 ; probably the unprivileged user can't write it anyways
356 StrCpy $INSTDIR "$PROFILE\$(^Name)"
357 ${endif}
358
359 ; prevent running multiple instances of the installer
360 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e'
361 Pop $R0
362 StrCmp $R0 0 +3
363 MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running." /SD IDOK
364 Abort
365 ; warn about a new install over an existing installation
366 ReadRegStr $R0 SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString"
367 StrCmp $R0 "" finish
368
369 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
370 "Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \
371 /SD IDYES IDYES remove IDNO finish
372
373 remove:
374 ; run the uninstaller
375 ClearErrors
376 ; we read the installation path of the old installation from the Registry
377 ReadRegStr $UNINSTDIR SHCTX "${PRODUCT_DIR_REGKEY}" "Path"
378 IfSilent dosilent nonsilent
379 dosilent:
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
380 ExecWait '$R0 /S _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
381 Goto finish
382 nonsilent:
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
383 ExecWait '$R0 _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
384 finish:
c8690d44 »
2009-01-17 Major improvements for the Windows installer:
385 FunctionEnd
386
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
387 Function un.onUninstSuccess
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
388 HideWindow
389 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." \
390 /SD IDOK
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
391 FunctionEnd
392
393 Function un.onInit
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
394 ; If the user does *not* have administrator privileges, abort
395 StrCpy $Answer ""
396 !insertmacro IsUserAdmin $Answer $UserName
397 ${if} $Answer == "yes"
398 SetShellVarContext all
399 ${else}
400 ; check if the Geany has been installed with admin permisions
401 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
402 ${if} $0 != ""
403 MessageBox MB_OK|MB_ICONSTOP "You need administrator privileges to uninstall Geany!" \
404 /SD IDOK
405 Abort
406 ${endif}
407 SetShellVarContext current
408 ${endif}
409
410 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" \
411 /SD IDYES IDYES +2
412 Abort
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
413 FunctionEnd
414
415 Function OnDirLeave
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
416 ClearErrors
417 SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR?
418 GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails)
419 FileOpen $0 "$1" "w" ; error to open?
420 FileWriteByte $0 "0"
421 IfErrors notPossible possible
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
422
423 notPossible:
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
424 RMDir "$INSTDIR" ; removes folder if empty
425 MessageBox MB_OK "The given directory is not writeable. Please choose another one!" /SD IDOK
426 Abort
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
427 possible:
b42da26f »
2009-01-17 Re-indent the whole file using Tabs for indentation.
428 FileClose $0
429 Delete "$1"
c380fb75 »
2007-12-04 Set svn:keywords and svn:eol-style for all files.
430 FunctionEnd
Something went wrong with that request. Please try again.