1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; geany.nsi - this file is part of Geany, a fast and lightweight IDE
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>
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.
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.
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.
22 ; Installer script for Geany (Windows Installer)
23 ; (Script originally generated by the HM NIS Edit Script Wizard)
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ; Do a Cyclic Redundancy Check to make sure the installer was not corrupted by the download
29 RequestExecutionLevel highest
; set execution level for Windows Vista
34 !define PRODUCT_NAME
"Geany"
35 !define PRODUCT_VERSION
"1.24"
36 !define PRODUCT_VERSION_ID
"1.24.0.0"
37 !define PRODUCT_PUBLISHER
"The Geany developer team"
38 !define PRODUCT_WEB_SITE
"http://www.geany.org/"
39 !define PRODUCT_DIR_REGKEY
"Software\Geany"
40 !define PRODUCT_UNINST_KEY
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
41 !define PRODUCT_EXE
"$INSTDIR\bin\Geany.exe"
42 !define PRODUCT_REGNAME
"Geany.ProjectFile"
43 !define PRODUCT_EXT
".geany"
44 !define RESOURCEDIR
"geany-${PRODUCT_VERSION}"
49 VIProductVersion
"${PRODUCT_VERSION_ID}"
50 VIAddVersionKey
"ProductName" "${PRODUCT_NAME}"
51 VIAddVersionKey
"FileVersion" "${PRODUCT_VERSION}"
52 VIAddVersionKey
"ProductVersion" "${PRODUCT_VERSION}"
53 VIAddVersionKey
"LegalCopyright" "Copyright 2005-2012 by the Geany developer team"
54 VIAddVersionKey
"FileDescription" "${PRODUCT_NAME} Installer"
56 BrandingText "$(^NAME) installer (NSIS 2.46)"
57 InstallDir "$PROGRAMFILES\Geany"
58 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
59 SetCompressor
/SOLID lzma
61 ShowUnInstDetails hide
64 OutFile "geany-${PRODUCT_VERSION}_setup.exe"
66 OutFile "geany-${PRODUCT_VERSION}_nogtk_setup.exe"
79 !define MUI_ABORTWARNING
80 !define MUI_ICON
"icons\geany.ico"
81 !define MUI_UNICON
"${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall-full.ico"
84 !insertmacro MUI_PAGE_WELCOME
86 ;!define MUI_LICENSEPAGE_RADIOBUTTONS
87 !insertmacro MUI_PAGE_LICENSE
"${RESOURCEDIR}\Copying.txt"
89 !insertmacro MUI_PAGE_COMPONENTS
91 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
92 !insertmacro MUI_PAGE_DIRECTORY
94 !define MUI_STARTMENUPAGE_DEFAULTFOLDER
"Geany"
95 !define MUI_STARTMENUPAGE_REGISTRY_ROOT
HKLM
96 !define MUI_STARTMENUPAGE_REGISTRY_KEY
"${PRODUCT_UNINST_KEY}"
97 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME
"Start Menu Folder"
98 !insertmacro MUI_PAGE_STARTMENU
${PRODUCT_NAME} "$StartmenuFolder"
100 !insertmacro MUI_PAGE_INSTFILES
102 !define MUI_FINISHPAGE_SHOWREADME
"$INSTDIR\News.txt"
103 !define MUI_FINISHPAGE_SHOWREADME_TEXT
"Show Release Notes"
104 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
105 !define MUI_FINISHPAGE_RUN
"$INSTDIR\bin\Geany.exe"
106 !define MUI_FINISHPAGE_RUN_NOTCHECKED
107 !insertmacro MUI_PAGE_FINISH
109 !insertmacro MUI_UNPAGE_INSTFILES
; Uninstaller page
110 !insertmacro MUI_LANGUAGE
"English" ; Language file
112 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
113 ; Sections and InstTypes ;
114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
118 Section "!Program Files" SEC01
122 SetOutPath "$INSTDIR"
123 File "${RESOURCEDIR}\*.txt"
125 SetOutPath "$INSTDIR\bin"
126 File "${RESOURCEDIR}\bin\Geany.exe"
128 SetOutPath "$INSTDIR\data"
129 File "${RESOURCEDIR}\data\GPL-2"
130 File "${RESOURCEDIR}\data\file*"
131 File "${RESOURCEDIR}\data\geany.glade"
132 File "${RESOURCEDIR}\data\geany.gtkrc"
133 File "${RESOURCEDIR}\data\snippets.conf"
134 File "${RESOURCEDIR}\data\ui_toolbar.xml"
136 SetOutPath "$INSTDIR\data\templates"
137 File /r
"${RESOURCEDIR}\data\templates\*"
139 SetOutPath "$INSTDIR\data\colorschemes"
140 File /r
"${RESOURCEDIR}\data\colorschemes\*"
142 SetOutPath "$INSTDIR\share\icons"
143 File /r
"${RESOURCEDIR}\share\icons\*"
145 SetOutPath "$INSTDIR"
147 CreateShortCut "$INSTDIR\Geany.lnk" "$INSTDIR\bin\Geany.exe"
148 !insertmacro MUI_STARTMENU_WRITE_BEGIN
${PRODUCT_NAME}
149 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
150 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Geany.lnk" "$INSTDIR\bin\Geany.exe"
151 !insertmacro MUI_STARTMENU_WRITE_END
153 ; register the extension .geany
154 ; write information about file type
155 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_REGNAME}" "" "${PRODUCT_NAME} Project File"
156 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_REGNAME}\DefaultIcon" "" "${PRODUCT_EXE},0"
157 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${PRODUCT_EXE}" "%1"'
158 ; write information about file extensions
159 WriteRegStr SHCTX
"Software\Classes\${PRODUCT_EXT}" "" "${PRODUCT_REGNAME}"
161 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) (0x08000000, 0, 0, 0)'
164 Section "Plugins" SEC02
167 SetOutPath "$INSTDIR\lib"
168 File "${RESOURCEDIR}\lib\*.dll"
171 Section "Language Files" SEC03
173 SetOutPath "$INSTDIR\share\locale"
174 File /r
"${RESOURCEDIR}\share\locale\*"
176 SetOutPath "$INSTDIR\share"
177 File /r
"gtk\share\*"
181 Section "Documentation" SEC04
184 SetOutPath "$INSTDIR"
185 File /r
"${RESOURCEDIR}\doc"
186 WriteIniStr
"$INSTDIR\Documentation.url" "InternetShortcut" "URL" "$INSTDIR\doc\Manual.html"
187 !insertmacro MUI_STARTMENU_WRITE_BEGIN
${PRODUCT_NAME}
188 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Documentation.lnk" "$INSTDIR\Documentation.url"
189 !insertmacro MUI_STARTMENU_WRITE_END
192 Section "Autocompletion Tags" SEC05
194 SetOutPath "$INSTDIR\data"
196 File "${RESOURCEDIR}\data\php.tags"
197 File "${RESOURCEDIR}\data\pascal.tags"
198 File "${RESOURCEDIR}\data\python.tags"
199 File "${RESOURCEDIR}\data\html_entities.tags"
200 File "${RESOURCEDIR}\data\c99.tags"
203 ; Include GTK runtime library but only if desired from command line
205 Section "GTK 2.16 Runtime Environment" SEC06
208 SetOutPath "$INSTDIR\bin"
210 SetOutPath "$INSTDIR\etc"
212 SetOutPath "$INSTDIR\lib"
217 Section "Context Menus" SEC07
219 WriteRegStr HKCR "*\shell\OpenWithGeany" "" "Open with Geany"
220 WriteRegStr HKCR "*\shell\OpenWithGeany" "Icon" "$INSTDIR\bin\geany.exe"
221 WriteRegStr HKCR "*\shell\OpenWithGeany\command" "" '"$INSTDIR\bin\geany.exe" "%1"'
224 Section "Desktop Shortcuts" SEC08
226 CreateShortCut "$DESKTOP\Geany.lnk" "$INSTDIR\bin\Geany.exe"
227 CreateShortCut "$QUICKLAUNCH\Geany.lnk" "$INSTDIR\bin\Geany.exe"
230 Section -AdditionalIcons
232 !insertmacro MUI_STARTMENU_WRITE_BEGIN
${PRODUCT_NAME}
233 WriteIniStr
"$INSTDIR\Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
234 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Website.lnk" "$INSTDIR\Website.url"
235 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "$INSTDIR\uninst.exe"
236 !insertmacro MUI_STARTMENU_WRITE_END
240 WriteUninstaller "$INSTDIR\uninst.exe"
241 WriteRegStr SHCTX
"${PRODUCT_DIR_REGKEY}" Path
"$INSTDIR"
242 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
243 ${if} $Answer ==
"yes" ; if user is admin
244 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
245 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
246 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\bin\Geany.exe"
247 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
248 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
249 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}"
250 WriteRegStr SHCTX
"${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
251 WriteRegDWORD SHCTX
"${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
252 WriteRegDWORD SHCTX
"${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
257 Delete "$INSTDIR\Website.url"
258 Delete "$INSTDIR\Documentation.url"
259 Delete "$INSTDIR\uninst.exe"
260 Delete "$INSTDIR\News.txt"
261 Delete "$INSTDIR\ReadMe.txt"
262 Delete "$INSTDIR\Thanks.txt"
263 Delete "$INSTDIR\ToDo.txt"
264 Delete "$INSTDIR\Authors.txt"
265 Delete "$INSTDIR\ChangeLog.txt"
266 Delete "$INSTDIR\Copying.txt"
267 Delete "$INSTDIR\Geany.lnk"
269 ; delete start menu entry
270 ReadRegStr $0 SHCTX
"${PRODUCT_UNINST_KEY}" "StartMenu"
273 Delete "$QUICKLAUNCH\Geany.lnk"
274 Delete "$DESKTOP\Geany.lnk"
276 RMDir /r
"$INSTDIR\bin"
277 RMDir /r
"$INSTDIR\doc"
278 RMDir /r
"$INSTDIR\data"
279 RMDir /r
"$INSTDIR\etc"
280 RMDir /r
"$INSTDIR\lib"
281 RMDir /r
"$INSTDIR\share"
284 ; remove .geany file extension
285 ReadRegStr $R0 SHCTX
"Software\Classes\${PRODUCT_EXT}" ""
286 ${if} $R0 ==
"${PRODUCT_REGNAME}"
287 DeleteRegKey SHCTX
"${PRODUCT_EXT}"
288 DeleteRegKey HKCR "${PRODUCT_EXT}"
289 DeleteRegKey SHCTX
"${PRODUCT_REGNAME}"
290 DeleteRegKey HKCR "${PRODUCT_REGNAME}"
293 DeleteRegKey HKCR "*\shell\OpenWithGeany"
295 DeleteRegKey SHCTX
"${PRODUCT_UNINST_KEY}"
296 DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
297 DeleteRegKey SHCTX
"${PRODUCT_DIR_REGKEY}"
298 DeleteRegKey HKCU "${PRODUCT_DIR_REGKEY}"
303 ;;;;;;;;;;;;;;;;;;;;;;;;;
304 ; Section descriptions ;
305 ;;;;;;;;;;;;;;;;;;;;;;;;;
306 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
307 !insertmacro MUI_DESCRIPTION_TEXT
${SEC01} "Required program files. You cannot skip these files."
308 !insertmacro MUI_DESCRIPTION_TEXT
${SEC02} "Available plugins like 'Version Diff', 'Class Builder' and 'Insert Special Characters'."
309 !insertmacro MUI_DESCRIPTION_TEXT
${SEC03} "Various translations of Geany's interface."
310 !insertmacro MUI_DESCRIPTION_TEXT
${SEC04} "Manual in Text and HTML format."
311 !insertmacro MUI_DESCRIPTION_TEXT
${SEC05} "Symbol lists necessary for auto completion of symbols."
313 !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."
315 !insertmacro MUI_DESCRIPTION_TEXT
${SEC07} "Add context menu item 'Open With Geany'"
316 !insertmacro MUI_DESCRIPTION_TEXT
${SEC08} "Create shortcuts for Geany on the desktop and in the Quicklaunch Bar"
317 !insertmacro MUI_FUNCTION_DESCRIPTION_END
319 ;;;;;;;;;;;;;;;;;;;;;
321 ;;;;;;;;;;;;;;;;;;;;;
323 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
324 !macro IsUserAdmin Result UName
330 UserInfo::GetAccountType
333 StrCpy ${Result} "yes"
335 StrCpy ${Result} "no"
340 StrCpy ${Result} "yes"
345 StrCpy "$StartmenuFolder" "Geany"
347 ; (from http://jabref.svn.sourceforge.net/viewvc/jabref/trunk/jabref/src/windows/nsis/setup.nsi)
348 ; If the user does *not* have administrator privileges, abort
351 !insertmacro IsUserAdmin
$Answer $UserName ; macro from LyXUtils.nsh
352 ${if} $Answer ==
"yes"
353 SetShellVarContext all
; set that e.g. shortcuts will be created for all users
355 SetShellVarContext current
356 ; TODO is this really what we want? $PROGRAMFILES is not much better because
357 ; probably the unprivileged user can't write it anyways
358 StrCpy $INSTDIR "$PROFILE\$(^Name)"
361 ; prevent running multiple instances of the installer
362 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e'
365 MessageBox MB_OK|
MB_ICONEXCLAMATION "The installer is already running." /SD
IDOK
367 ; warn about a new install over an existing installation
368 ReadRegStr $R0 SHCTX
"${PRODUCT_UNINST_KEY}" "UninstallString"
371 MessageBox MB_YESNO|
MB_ICONEXCLAMATION \
372 "Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ?" \
373 /SD
IDYES IDYES remove
IDNO finish
376 ; run the uninstaller
378 ; we read the installation path of the old installation from the Registry
379 ReadRegStr $UNINSTDIR SHCTX
"${PRODUCT_DIR_REGKEY}" "Path"
380 IfSilent dosilent nonsilent
382 ExecWait '$R0 /S _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
385 ExecWait '$R0 _?=$UNINSTDIR' ;Do not copy the uninstaller to a temp file
389 Function un
.onUninstSuccess
391 MessageBox MB_ICONINFORMATION|
MB_OK "$(^Name) was successfully removed from your computer." \
396 ; If the user does *not* have administrator privileges, abort
398 !insertmacro IsUserAdmin
$Answer $UserName
399 ${if} $Answer ==
"yes"
400 SetShellVarContext all
402 ; check if the Geany has been installed with admin permisions
403 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
405 MessageBox MB_OK|
MB_ICONSTOP "You need administrator privileges to uninstall Geany!" \
409 SetShellVarContext current
412 MessageBox MB_ICONQUESTION|
MB_YESNO|MB_DEFBUTTON2
"Are you sure you want to completely remove $(^Name) and all of its components?" \
419 SetOutPath "$INSTDIR" ; what about IfError creating $INSTDIR?
420 GetTempFileName $1 "$INSTDIR" ; creates tmp file (or fails)
421 FileOpen $0 "$1" "w" ; error to open?
423 IfErrors notPossible possible
426 RMDir "$INSTDIR" ; removes folder if empty
427 MessageBox MB_OK "The given directory is not writeable. Please choose another one!" /SD
IDOK