2007-12-04 15:44:45 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Installer script for Geany (Windows Installer) ;
; Script generated by the HM NIS Edit Script Wizard. :
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;
; helper defines ;
;;;;;;;;;;;;;;;;;;;
!define PRODUCT_NAME " Geany "
2008-10-19 13:52:12 +00:00
!define PRODUCT_VERSION " 0.16 "
!define PRODUCT_VERSION_ID " 0.16.0.0 "
2008-01-23 14:45:53 +00:00
!define PRODUCT_PUBLISHER " Enrico Troeger "
2008-09-01 11:15:16 +00:00
!define PRODUCT_WEB_SITE " http://www.geany.org/ "
2007-12-04 15:44:45 +00:00
!define PRODUCT_DIR_REGKEY " Software\Microsoft\Windows\CurrentVersion\App Paths\Geany.exe "
!define PRODUCT_UNINST_KEY " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME} "
!define PRODUCT_UNINST_ROOT_KEY " HKLM "
!define PRODUCT_STARTMENU_REGVAL " NSIS:StartMenuDir "
!define RESOURCEDIR " geany-${PRODUCT_VERSION} "
SetCompressor /SOLID lzma
2008-11-19 18:03:32 +00:00
2007-12-04 15:44:45 +00:00
XPStyle on
2008-11-19 18:03:32 +00:00
; set execution level for Windows Vista
RequestExecutionLevel user
2007-12-04 15:44:45 +00:00
Name " ${PRODUCT_NAME} ${PRODUCT_VERSION} "
2008-01-23 14:45:53 +00:00
InstallDir " $PROGRAMFILES \Geany "
InstallDirRegKey HKLM " ${PRODUCT_DIR_REGKEY} " " "
ShowInstDetails hide
ShowUnInstDetails hide
2007-12-04 15:44:45 +00:00
!ifdef INCLUDE_GTK
OutFile " geany-${PRODUCT_VERSION}_setup.exe "
!else
OutFile " geany-${PRODUCT_VERSION}_nogtk_setup.exe "
!endif
;;;;;;;;;;;;;;;;;;;;;
; Version resource ;
;;;;;;;;;;;;;;;;;;;;;
VIProductVersion " ${PRODUCT_VERSION_ID} "
VIAddVersionKey " ProductName " " ${PRODUCT_NAME} "
VIAddVersionKey " FileVersion " " ${PRODUCT_VERSION} "
VIAddVersionKey " ProductVersion " " ${PRODUCT_VERSION} "
2008-02-05 15:01:07 +00:00
VIAddVersionKey " LegalCopyright " " Copyright 2005-2008 by the Geany developers "
2007-12-04 15:44:45 +00:00
VIAddVersionKey " FileDescription " " ${PRODUCT_NAME} Installer "
2008-10-15 15:50:06 +00:00
;Request application privileges for Windows Vista
RequestExecutionLevel user
2007-12-04 15:44:45 +00:00
;;;;;;;;;;;;;;;;
; Init code ;
;;;;;;;;;;;;;;;;
Function .onInit
2008-11-19 18:03:32 +00:00
SetShellVarContext all
2007-12-04 15:44:45 +00:00
; prevent running multiple instances of the installer
System :: Call 'kernel32::CreateMutexA(i 0, i 0, t "geany_installer") i .r1 ?e'
Pop $R0
StrCmp $R0 0 + 3
2008-11-19 18:03:32 +00:00
MessageBox MB_OK | MB_ICONEXCLAMATION " The installer is already running. " /SD IDOK
2007-12-04 15:44:45 +00:00
Abort
; warn about a new install over an existing installation
ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " UninstallString "
StrCmp $R0 " " done
MessageBox MB_YESNO | MB_ICONEXCLAMATION \
2008-11-19 18:03:32 +00:00
" Geany has already been installed. $\nDo you want to remove the previous version before installing $(^Name) ? " \
/SD IDYES IDYES remove IDNO done
2007-12-04 15:44:45 +00:00
2008-11-19 18:03:32 +00:00
remove :
2007-12-04 15:44:45 +00:00
;Run the uninstaller
ClearErrors
2008-11-19 18:03:32 +00:00
IfSilent dosilent nonsilent
dosilent :
;TODO read $INSTDIR from registry, the instdir of the old installation might be different
; from the new one (command line arg /D=...)
ExecWait '$R0 /S _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
Goto done
nonsilent :
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
2007-12-04 15:44:45 +00:00
done :
FunctionEnd
;;;;;;;;;;;;;;;;
; MUI Settings ;
;;;;;;;;;;;;;;;;
!include " MUI.nsh "
!define MUI_ABORTWARNING
!define MUI_ICON " pixmaps\geany.ico "
!define MUI_UNICON " ${NSISDIR} \Contrib\Graphics\Icons\modern-uninstall-full.ico "
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
;!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE " ${RESOURCEDIR}\Copying.txt "
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
!define MUI_STARTMENUPAGE_DEFAULTFOLDER " Geany "
!define MUI_STARTMENUPAGE_REGISTRY_ROOT " ${PRODUCT_UNINST_ROOT_KEY} "
!define MUI_STARTMENUPAGE_REGISTRY_KEY " ${PRODUCT_UNINST_KEY} "
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME " ${PRODUCT_STARTMENU_REGVAL} "
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
2008-08-17 14:19:34 +00:00
!define MUI_FINISHPAGE_RUN " $INSTDIR \bin\Geany.exe "
2007-12-04 15:44:45 +00:00
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE " English "
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Sections and InstTypes ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
InstType " Full "
InstType " Minimal "
Section " !Program Files " SEC01
SectionIn RO 1 2
SetOverwrite ifnewer
2008-08-17 14:19:34 +00:00
SetOutPath " $INSTDIR "
2007-12-04 15:44:45 +00:00
File " ${RESOURCEDIR}\*.txt "
2008-08-17 14:19:34 +00:00
SetOutPath " $INSTDIR \bin "
File " ${RESOURCEDIR}\bin\Geany.exe "
2007-12-04 15:44:45 +00:00
SetOutPath " $INSTDIR \data "
File " ${RESOURCEDIR}\data\GPL-2 "
File " ${RESOURCEDIR}\data\file* "
2008-08-17 14:19:34 +00:00
File " ${RESOURCEDIR}\data\snippets.conf "
2008-12-06 18:58:03 +00:00
File " ${RESOURCEDIR}\data\ui_toolbar.xml "
2007-12-04 15:44:45 +00:00
2008-06-09 19:29:54 +00:00
SetOutPath " $INSTDIR \share\icons "
File /r " ${RESOURCEDIR}\share\icons\* "
2007-12-04 15:44:45 +00:00
SetOutPath " $INSTDIR "
2008-10-15 15:50:06 +00:00
CreateShortCut " $INSTDIR \Geany.lnk " " $INSTDIR \bin\Geany.exe "
2007-12-04 15:44:45 +00:00
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory " $SMPROGRAMS \$ICONS_GROUP "
2008-08-17 14:19:34 +00:00
CreateShortCut " $SMPROGRAMS \$ICONS_GROUP\Geany.lnk " " $INSTDIR \bin\Geany.exe "
2007-12-04 15:44:45 +00:00
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section " Plugins " SEC02
SectionIn 1
SetOverwrite ifnewer
2008-06-09 19:29:54 +00:00
SetOutPath " $INSTDIR \lib "
File " ${RESOURCEDIR}\lib\*.dll "
2007-12-04 15:44:45 +00:00
SectionEnd
Section " Language Files " SEC03
SectionIn 1
2008-06-09 19:29:54 +00:00
SetOutPath " $INSTDIR \share\locale "
File /r " ${RESOURCEDIR}\share\locale\* "
2007-12-04 15:44:45 +00:00
SectionEnd
Section " Documentation " SEC04
SectionIn 1
SetOverwrite ifnewer
SetOutPath " $INSTDIR "
File /r " ${RESOURCEDIR}\doc "
2008-01-23 14:45:53 +00:00
WriteIniStr " $INSTDIR \Documentation.url " " InternetShortcut " " URL " " $INSTDIR \doc\Manual.html "
2008-10-15 15:50:06 +00:00
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
2007-12-04 15:44:45 +00:00
CreateShortCut " $SMPROGRAMS \$ICONS_GROUP\Documentation.lnk " " $INSTDIR \Documentation.url "
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section " Autocompletion Tags " SEC05
SectionIn 1
SetOutPath " $INSTDIR \data "
SetOverwrite ifnewer
File " ${RESOURCEDIR}\data\php.tags "
File " ${RESOURCEDIR}\data\pascal.tags "
File " ${RESOURCEDIR}\data\latex.tags "
2008-08-17 14:19:34 +00:00
File " ${RESOURCEDIR}\data\python.tags "
2007-12-04 15:44:45 +00:00
File " ${RESOURCEDIR}\data\html_entities.tags "
File " ${RESOURCEDIR}\data\global.tags "
SectionEnd
; Include GTK runtime library but only if desired from command line
!ifdef INCLUDE_GTK
2008-01-23 14:45:53 +00:00
Section " GTK 2.12 Runtime Environment " SEC06
2007-12-04 15:44:45 +00:00
SectionIn 1
SetOverwrite ifnewer
2008-08-17 14:19:34 +00:00
SetOutPath " $INSTDIR \bin "
File /r " gtk\bin\* "
2007-12-04 15:44:45 +00:00
SetOutPath " $INSTDIR \etc "
File /r " gtk\etc\* "
SetOutPath " $INSTDIR \lib "
File /r " gtk\lib\* "
2008-06-09 19:29:54 +00:00
SetOutPath " $INSTDIR \share "
File /r " gtk\share\* "
2007-12-04 15:44:45 +00:00
/ * code to embed GTK+ installer executable
File ${GTK_INSTALLER}
ExecWait ${GTK_INSTALLER}
* /
SectionEnd
!endif
2008-10-15 15:50:06 +00:00
Section " Context Menus " SEC07
2007-12-04 15:44:45 +00:00
SectionIn 1
WriteRegStr HKCR " *\shell\OpenWithGeany " " " " Open with Geany "
2008-08-17 14:19:34 +00:00
WriteRegStr HKCR " *\shell\OpenWithGeany\command " " " '$INSTDIR\bin\geany.exe "%1"'
2007-12-04 15:44:45 +00:00
SectionEnd
2008-10-15 15:50:06 +00:00
Section " Desktop Shortcuts " SEC08
SectionIn 1
CreateShortCut " $DESKTOP \Geany.lnk " " $INSTDIR \bin\Geany.exe "
CreateShortCut " $QUICKLAUNCH \Geany.lnk " " $INSTDIR \bin\Geany.exe "
SectionEnd
2007-12-04 15:44:45 +00:00
Section - AdditionalIcons
SetOutPath $INSTDIR
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
2008-08-17 14:19:34 +00:00
WriteIniStr " $INSTDIR \Website.url " " InternetShortcut " " URL " " ${PRODUCT_WEB_SITE} "
CreateShortCut " $SMPROGRAMS \$ICONS_GROUP\Website.lnk " " $INSTDIR \Website.url "
2007-12-04 15:44:45 +00:00
CreateShortCut " $SMPROGRAMS \$ICONS_GROUP\Uninstall.lnk " " $INSTDIR \uninst.exe "
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
Section - Post
WriteUninstaller " $INSTDIR \uninst.exe "
2008-08-17 14:19:34 +00:00
WriteRegStr HKLM " ${PRODUCT_DIR_REGKEY} " " " " $INSTDIR \bin\Geany.exe "
2007-12-04 15:44:45 +00:00
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " DisplayName " " $(^Name) "
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " UninstallString " " $INSTDIR \uninst.exe "
2008-08-17 14:19:34 +00:00
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " DisplayIcon " " $INSTDIR \bin\Geany.exe "
2007-12-04 15:44:45 +00:00
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " DisplayVersion " " ${PRODUCT_VERSION} "
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " URLInfoAbout " " ${PRODUCT_WEB_SITE} "
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " URLUpdateInfo " " ${PRODUCT_WEB_SITE} "
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} " " Publisher " " ${PRODUCT_PUBLISHER} "
SectionEnd
2008-01-23 14:45:53 +00:00
2007-12-04 15:44:45 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;
; Section descriptions ;
;;;;;;;;;;;;;;;;;;;;;;;;;
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} " Required program files. You cannot skip these files. "
2008-08-17 14:19:34 +00:00
!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} " Available plugins like 'Version Diff', 'Class Builder' and 'Insert Special Characters'. "
2007-12-04 15:44:45 +00:00
!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} " Various translations of Geany's interface. "
!insertmacro MUI_DESCRIPTION_TEXT ${SEC04} " Manual in Text and HTML format. "
!insertmacro MUI_DESCRIPTION_TEXT ${SEC05} " Symbol lists necessary for auto completion of symbols. "
!ifdef INCLUDE_GTK
!insertmacro MUI_DESCRIPTION_TEXT ${SEC06} " You need this files to run Geany. If you have already installed a GTK Runtime Environment (2.6 or higher), you can skip it. "
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SEC07} " Add context menu item 'Open With Geany' "
2008-10-15 15:50:06 +00:00
!insertmacro MUI_DESCRIPTION_TEXT ${SEC08} " Create shortcuts for Geany on the desktop and in the Quicklaunch Bar "
2007-12-04 15:44:45 +00:00
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;;;;;;;;;;;;;;;;;;;;;
; helper functions ;
;;;;;;;;;;;;;;;;;;;;;
Function un.onUninstSuccess
HideWindow
2008-11-19 18:03:32 +00:00
MessageBox MB_ICONINFORMATION | MB_OK " $(^Name) was successfully removed from your computer. " /SD IDOK
2007-12-04 15:44:45 +00:00
FunctionEnd
Function un.onInit
2008-11-19 18:03:32 +00:00
MessageBox MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2 " Are you sure you want to completely remove $(^Name) and all of its components? " /SD IDYES IDYES + 2
2007-12-04 15:44:45 +00:00
Abort
FunctionEnd
Function OnDirLeave
ClearErrors
SetOutPath " $INSTDIR " ; what about IfError creating $INSTDIR?
GetTempFileName $1 " $INSTDIR " ; creates tmp file (or fails)
FileOpen $0 " $1 " " w " ; error to open?
FileWriteByte $0 " 0 "
IfErrors notPossible possible
notPossible :
RMDir " $INSTDIR " ; removes folder if empty
2008-11-19 18:03:32 +00:00
MessageBox MB_OK " The given directory is not writeable. Please choose another one! " /SD IDOK
2007-12-04 15:44:45 +00:00
Abort
possible :
FileClose $0
Delete " $1 "
FunctionEnd
Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER " Application " $ICONS_GROUP
2008-08-17 14:19:34 +00:00
Delete " $INSTDIR \Website.url "
2007-12-04 15:44:45 +00:00
Delete " $INSTDIR \Documentation.url "
Delete " $INSTDIR \uninst.exe "
Delete " $INSTDIR \News.txt "
Delete " $INSTDIR \ReadMe.txt "
Delete " $INSTDIR \Thanks.txt "
Delete " $INSTDIR \ToDo.txt "
Delete " $INSTDIR \Authors.txt "
Delete " $INSTDIR \ChangeLog.txt "
Delete " $INSTDIR \Copying.txt "
2008-08-17 14:19:34 +00:00
Delete " $INSTDIR \Geany.lnk "
2008-06-09 19:29:54 +00:00
2007-12-04 15:44:45 +00:00
Delete " $SMPROGRAMS \$ICONS_GROUP\Uninstall.lnk "
Delete " $SMPROGRAMS \$ICONS_GROUP\Website.lnk "
Delete " $QUICKLAUNCH \Geany.lnk "
Delete " $DESKTOP \Geany.lnk "
Delete " $SMPROGRAMS \$ICONS_GROUP\Geany.lnk "
Delete " $SMPROGRAMS \$ICONS_GROUP\Documentation.lnk "
RMDir " $SMPROGRAMS \$ICONS_GROUP "
2008-08-17 14:19:34 +00:00
RMDir /r " $INSTDIR \bin "
2007-12-04 15:44:45 +00:00
RMDir /r " $INSTDIR \doc "
RMDir /r " $INSTDIR \data "
RMDir /r " $INSTDIR \etc "
RMDir /r " $INSTDIR \lib "
RMDir /r " $INSTDIR \share "
RMDir " $INSTDIR "
DeleteRegKey HKCR " *\shell\OpenWithGeany "
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY} "
DeleteRegKey HKLM " ${PRODUCT_DIR_REGKEY} "
SetAutoClose true
SectionEnd