swirl
Guide to OmniMark 9   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Other Library Functions  
function  

vfs.change-permissions

 
 

Library: File system utilities (OMVFS)
Import: omvfs.xmd

Declaration

export external function change-permissions
                value string  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

path
The file or directory whose permissions are to be changed.
on-dir
A vfs.directory object. If a vfs.directory object is specified the path parameter is relative to the vfs.directory and must be expressed as a relative URL.
mode
A union of the permissions to be set.
mask
is a union of the permissions to be modified.
contents
Specifies whether the permissions of the content of a directory are also to be changed. Values are vfs.contents-included or vfs.content-not-included. The default is vfs.contents-not-included.


Purpose

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.

Notes

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.

Exceptions

The following exceptions may occur:

      Other Library Functions
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 9.1.0 Documentation Generated: September 2, 2010 at 1:38:10 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2010.