|
|||||
|
||||||
Other Library Functions |
function |
vfs.change-permissions |
Library: General, File system utilities (OMVFS)
Import: omvfs.xmd |
export external function change-permissions value stream path on value directory on-dir optional to value integer mode modifying value integer mask optional contents value switch contents optional initial {contents-not-included}
Argument definitions
You can use vfs.change-permissions to set or alter the permissions of a file or directory.
The following program sets the file "myfile.txt" to be readable by everybody, but only writable by its owner and other group members.
import "omvfs.xmd" prefixed by vfs. process vfs.change-permissions "myfile.txt" to (vfs.permit-all-read union vfs.permit-user-write union vfs.permit-group-write)
The following program turns off the archive attribute of directory "testdir" and all its contents.
import "omvfs.xmd" prefixed by vfs. process vfs.change-permissions "testdir" to 0 modifying vfs.permit-archive contents vfs.contents-included
The following constants are usable for the mode and mask parameters. Multiple attributes can be set at once by creating a union.
If any of permit-user-write, permit-group-write and permit-other-write is set on Windows, then they are all set due to OS limitations.
Some UNIX systems do not allow non-root users to set permit-sticky.
Attributes not supported by a particular OS will be ignored.
If mask is not specified, then the target's permissions are changed to match those specified in mode.
If mask is specified, then only the permissions specified in the mask will be modified to the matching values in mode.
If contents is set to contents-included and the target is a directory, then the directory along with its contents will be changed recursively to the specified permissions.
The following exceptions may occur: