diff --git a/ChangeLog b/ChangeLog index d1ce9c7dc..9e804959e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2007-05-07 Enrico Tröger * 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 diff --git a/geany.nsi b/geany.nsi index c7e6b5128..fe07d37ec 100644 --- a/geany.nsi +++ b/geany.nsi @@ -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"