Sujay
19th January 2006 11:47 UTC
Problem with Destination Folder's wright permission
Hi,
i hv come accross one problem. i made a setup.exe for one application for windows. now i want to check that the destination folder user want to install is having the wright permissions or not. because at one machine there might not hving permission to wright in program files. I want to check this while installing the application and want to give one message to user to choose another folder.
thanks in advance.
-- Sujay
kichik
19th January 2006 19:02 UTC
You can use a method similar to that in the following thread:
http://forums.winamp.com/showthread....ite+permission
Though I'd use GetTempFileName so it won't overwrite any files.
Sujay
20th January 2006 05:18 UTC
thanks .
but can u send me any exmple srcipts to use this. i tried a lot but didnt understand how to do this.
Takhir
20th January 2006 07:14 UTC
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE OnDirLeave
!insertmacro MUI_PAGE_DIRECTORY
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 "Not able to write into this directory!"
Abort
possible:
FileClose $0
Delete "$1"
FunctionEnd