diff options
| author | ominitay <37453713+ominitay@users.noreply.github.com> | 2022-01-08 21:22:23 +0000 |
|---|---|---|
| committer | ominitay <37453713+ominitay@users.noreply.github.com> | 2022-02-13 20:56:06 +0000 |
| commit | 11b4cc589c85b6330824ac9a64bfb0829cc1adb0 (patch) | |
| tree | e7d013c8c80ce78c1b12285ddee4fd5f2cc41822 /src/Compilation.zig | |
| parent | b2610649fcf43c678fd81f3bef71f3ba42ee3606 (diff) | |
| download | zig-11b4cc589c85b6330824ac9a64bfb0829cc1adb0.tar.gz zig-11b4cc589c85b6330824ac9a64bfb0829cc1adb0.zip | |
std.fs: Implement cross-platform metadata API
Implements a cross-platform metadata API, aiming to reduce unnecessary Unix-dependence of the `std.fs` api. Presently, all OSes beside Windows are treated as Unix; this is likely the best way to treat things by default, instead of explicitly listing each Unix-like OS.
Platform-specific operations are not provided by `File.Metadata`, and instead are to be accessed from `File.Metadata.inner`.
Adds:
- File.setPermissions() : Sets permission of a file according to a `Permissions` struct (not available on WASI)
- File.Permissions : A cross-platform representation of file permissions
- Permissions.readOnly() : Returns whether the file is read-only
- Permissions.setReadOnly() : Sets whether the file is read-only
- Permissions.unixSet() : Sets permissions for a class (UNIX-only)
- Permissions.unixGet() : Checks a permission for a class (UNIX-only)
- Permissions.unixNew() : Returns a new Permissions struct to represent the passed mode (UNIX-only)
- File.Metadata : A cross-platform representation of file metadata
- Metadata.size() : Returns the size of a file
- Metadata.permissions() : Returns a `Permissions` struct, representing permissions on the file
- Metadata.kind() : Returns the `Kind` of the file
- Metadata.accessed() : Returns the time the file was last accessed
- Metadata.modified() : Returns the time the file was last modified
- Metadata.created() : Returns the time the file was created (this is an optional, as the underlying filesystem, or OS may not support this)
Methods of `File.Metadata` are also available for the below, so I won't repeat myself
The below may be used for platform-specific functionality
- File.MetadataUnix : The internal implementation of `File.Metadata` on Unices
- File.MetadataLinux : The internal implementation of `File.Metadata` on Linux
- File.MetadataWindows : The implementation of `File.Metadata` on Windows
Diffstat (limited to 'src/Compilation.zig')
0 files changed, 0 insertions, 0 deletions
