FolderItem.Permissions
From Xojo Documentation
This property is only available on macOS and Linux platforms. For cross-platform compatibility, use #If...#Endif with the Target... specifiers to make sure you will not attempt to use this property on an incompatible platform. |
or
IntegerValue = aFolderItem.Permissions
New in 2005r1
Supported for all project types and targets.
Gets and sets the permissions of the FolderItem on Unix-based operating systems only (macOS and Linux).
Notes
For web apps, it is important to ensure that you set permissions correctly for any files that you create on the web server and later intend to modify, write or delete.
You can get and set the permissions as an octal Integer or you can get and set the permissions via the properties of the Permissions class. Permissions is represented as a three-digit numeric code (in octal or base 8), in which each digit ranges from 0 to 7.
The digits correspond to the permissions of the FolderItem owner, the owning group, and other users not in the owning group, in that order. The code for each digit is computed using the following values:
Value | Description |
---|---|
1 | Execute |
2 | Write |
4 | Read |
For each digit, the permissions are expressed by adding up the values. Each digit can take on the following values:
Value | Description |
---|---|
0 | No permissions |
1 | Execute |
2 | Write |
3 | Write and Execute |
4 | Read |
5 | Read ane Execute |
6 | Read and Write |
7 | Read, Write, and Execute |
For example, the the octal value "764" is interpreted as follows:
Value | Description | Owner |
---|---|---|
7 | Read, Write, and Execute | Owning User |
6 | Read and Write | Owning Group |
4 | Read | Others |
When referring to an octal number in Xojo, you have to prefix it with the "&o". So octal 764 is written as:
&o764
Example
You can set these permissions by assigning the octal value to the Permissions property, i.e.,
For more information on setting Unix permissions, see the documentation for the Unix function chmod.