struct MetadataWindows [src]

Fields

attributes: windows.DWORD
reparse_tag: windows.DWORD
_size: u64
access_time: i128
modified_time: i128
creation_time: i128

Members

Source

pub const MetadataWindows = struct { attributes: windows.DWORD, reparse_tag: windows.DWORD, _size: u64, access_time: i128, modified_time: i128, creation_time: i128, const Self = @This(); /// Returns the size of the file pub fn size(self: Self) u64 { return self._size; } /// Returns a `Permissions` struct, representing the permissions on the file pub fn permissions(self: Self) Permissions { return .{ .inner = .{ .attributes = self.attributes } }; } /// Returns the `Kind` of the file. /// Can only return: `.file`, `.directory`, `.sym_link` or `.unknown` pub fn kind(self: Self) Kind { if (self.attributes & windows.FILE_ATTRIBUTE_REPARSE_POINT != 0) { if (self.reparse_tag & windows.reparse_tag_name_surrogate_bit != 0) { return .sym_link; } } else if (self.attributes & windows.FILE_ATTRIBUTE_DIRECTORY != 0) { return .directory; } else { return .file; } return .unknown; } /// Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01 pub fn accessed(self: Self) i128 { return self.access_time; } /// Returns the time the file was modified in nanoseconds since UTC 1970-01-01 pub fn modified(self: Self) i128 { return self.modified_time; } /// Returns the time the file was created in nanoseconds since UTC 1970-01-01. /// This never returns null, only returning an optional for compatibility with other OSes pub fn created(self: Self) ?i128 { return self.creation_time; } }