structstd.fs.File.MetadataWindows[src]

Fields

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

Functions

Functionsize[src]

pub fn size(self: Self) u64

Returns the size of the file

Parameters

self: Self

Source Code

Source code
pub fn size(self: Self) u64 {
    return self._size;
}

Functionpermissions[src]

pub fn permissions(self: Self) Permissions

Returns a Permissions struct, representing the permissions on the file

Parameters

self: Self

Source Code

Source code
pub fn permissions(self: Self) Permissions {
    return .{ .inner = .{ .attributes = self.attributes } };
}

Functionkind[src]

pub fn kind(self: Self) Kind

Returns the Kind of the file. Can only return: .file, .directory, .sym_link or .unknown

Parameters

self: Self

Source Code

Source code
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;
}

Functionaccessed[src]

pub fn accessed(self: Self) i128

Returns the last time the file was accessed in nanoseconds since UTC 1970-01-01

Parameters

self: Self

Source Code

Source code
pub fn accessed(self: Self) i128 {
    return self.access_time;
}

Functionmodified[src]

pub fn modified(self: Self) i128

Returns the time the file was modified in nanoseconds since UTC 1970-01-01

Parameters

self: Self

Source Code

Source code
pub fn modified(self: Self) i128 {
    return self.modified_time;
}

Functioncreated[src]

pub fn created(self: Self) ?i128

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

Parameters

self: Self

Source Code

Source code
pub fn created(self: Self) ?i128 {
    return self.creation_time;
}

Source Code

Source code
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;
    }
}