Cross-platform representation of permissions on a file. The readonly
and setReadonly
are the only methods available across all platforms. Platform-specific functionality is available through the inner
field.
Fields
inner: switch (builtin.os.tag) { .windows => PermissionsWindows, else => PermissionsUnix, },
You may use the inner
field to use platform-specific functionality
Functions
fn readOnly(self: Self) bool
Returns
true
if permissions represent an unwritable file. On Unix,true
is …Returns
true
if permissions represent an unwritable file. On Unix,true
is returned only if no class has write permissions.fn setReadOnly(self: *Self, read_only: bool) void
Sets whether write permissions are provided. On Unix, this affects all classe…
Sets whether write permissions are provided. On Unix, this affects all classes. If this is undesired, use
unixSet
This method DOES NOT set permissions on the filesystem: useFile.setPermissions(permissions)