Prevent installation in a directory without proper write permissions under Windows. Display an error message instead.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1513 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-05-07 15:36:43 +00:00
parent 7821bde1d2
commit c9d5ef64c1
2 changed files with 24 additions and 3 deletions

View File

@ -1,6 +1,9 @@
2007-05-07 Enrico Tröger <enrico.troeger@uvena.de>
* data/filetypes.haskell: Added build instructions.
* geany.nsi: Prevent installation in a directory without proper
write permissions under Windows.
Display an error message instead.
2007-05-06 Enrico Tröger <enrico.troeger@uvena.de>

View File

@ -20,7 +20,7 @@
!define RESOURCEDIR "geany-${PRODUCT_VERSION}"
; only used when embedding GTK+ installer
!define GTK_INSTALLER "gtk+-2.8.18-setup-1.exe"
!define GTK_INSTALLER "gtk+-2.10.6-1-setup.exe"
SetCompressor /SOLID lzma
XPStyle on
@ -89,6 +89,7 @@ FunctionEnd
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Directory page
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
!insertmacro MUI_PAGE_DIRECTORY
; Start menu page
var ICONS_GROUP
@ -145,7 +146,7 @@ SectionEnd
Section "Documentation" SEC03
SectionIn 1
SetOverwrite try
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File /r "${RESOURCEDIR}\doc"
@ -169,7 +170,7 @@ SectionEnd
; Include GTK runtime library but only if desired from command line
!ifdef INCLUDE_GTK
Section "GTK 2.8 Runtime Environment" SEC05
Section "GTK 2.10 Runtime Environment" SEC05
SectionIn 1
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
@ -243,6 +244,23 @@ Function un.onInit
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
MessageBox MB_OK "The given directory is not writeable. Please choose another one!"
Abort
possible:
FileClose $0
Delete "$1"
FunctionEnd
Section Uninstall
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
Delete "$INSTDIR\${PRODUCT_NAME}.url"