aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-10-01 23:04:32 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-10-02 17:02:24 -0700
commit309c53295f26999065e4dc76cef4d90f8d85fb38 (patch)
tree09a0abc2ad1e0252e12ae27d81853b129040ad5d /lib/std
parenta4352982b3ad4370543e0d4486347b58a958ed6b (diff)
downloadzig-309c53295f26999065e4dc76cef4d90f8d85fb38.tar.gz
zig-309c53295f26999065e4dc76cef4d90f8d85fb38.zip
std.fs: give readLink an explicit error set
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/fs.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 2429243dda..0d1d506143 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -2003,10 +2003,12 @@ pub const Dir = struct {
return os.windows.CreateSymbolicLink(self.fd, sym_link_path_w, target_path_w, flags.is_directory);
}
+ pub const ReadLinkError = os.ReadLinkError;
+
/// Read value of a symbolic link.
/// The return value is a slice of `buffer`, from index `0`.
/// Asserts that the path parameter has no null bytes.
- pub fn readLink(self: Dir, sub_path: []const u8, buffer: []u8) ![]u8 {
+ pub fn readLink(self: Dir, sub_path: []const u8, buffer: []u8) ReadLinkError![]u8 {
if (builtin.os.tag == .wasi and !builtin.link_libc) {
return self.readLinkWasi(sub_path, buffer);
}