Checking access permissions of a file or directoryΒΆ
access() |
Check access permissions of a file or directory |
SYNTAX
access(pathname, mode)
Checks the existence or access permission of a file or directory.
pathname |
The path of the file or directory to be checked. |
||||||||
mode |
The type of check to be made. The possible values for mode are defined in the standard include file $SCULPTOR/include/files.h, and are as follows:
The mode TEST_EXISTS must be tested on its own; the other modes may be combined using the | operator. |
The function returns zero if the file exists or if the current user has the specified permission(s); otherwise it returns -1 and assigns the operating system error code to sys.Errno.
EXAMPLES
if (access(tmp.FilePath, TEST_EXISTS) = 0) {
prompt "File already exists - over-write?" \
button = " YES " \
button = " NO ", FINISH
if (access("/logdir", TEST_CANEXEC | TEST_CANREAD | TEST_CANWRI | TE) <> 0) {
info "Permission denied"
}
RELATED TOPICS |