struct PermissionsWindows [src]
Fields
attributes: windows.DWORD
Members
- readOnly (Function)
- setReadOnly (Function)
Source
pub const PermissionsWindows = struct {
attributes: windows.DWORD,
const Self = @This();
/// Returns `true` if permissions represent an unwritable file.
pub fn readOnly(self: Self) bool {
return self.attributes & windows.FILE_ATTRIBUTE_READONLY != 0;
}
/// Sets whether write permissions are provided.
/// This method *DOES NOT* set permissions on the filesystem: use `File.setPermissions(permissions)`
pub fn setReadOnly(self: *Self, read_only: bool) void {
if (read_only) {
self.attributes |= windows.FILE_ATTRIBUTE_READONLY;
} else {
self.attributes &= ~@as(windows.DWORD, windows.FILE_ATTRIBUTE_READONLY);
}
}
}