I tried to use the following script to determine, wether the user has the permission to write into the installation directory or not.
According to the helpfile and what I'm used to when working with files under windows, it should have worked, what means, that FileOpen should not have worked.Function OnDirLeave
ClearErrors
SetOutPath $INSTDIR
FileOpen $0 "test.dat" "w"
;StrCmp $0 "" notPossible possible
IfErrors notPossible possible
notPossible:
MessageBox MB_OK "Not able to write into this directory!"
Abort
possible:
FileClose $0
FunctionEnd
But it did! Checking the permissions with this function failed!
So I tried the following one, which solved the problem:
Now my question is, if anyone can explain to me, why the first version didn't work!Function OnDirLeave
ClearErrors
SetOutPath $INSTDIR
FileOpen $0 "test.dat" "w"
FileWriteByte $0 "0"
IfErrors notPossible possible
notPossible:
MessageBox MB_OK "Not able to write into this directory!"
Abort
possible:
FileClose $0
Delete "$INSTDIR\test.dat"
FunctionEnd
TIA
Christian
P.S.: Please excuse my poor english!