zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 309c53295f26999065e4dc76cef4d90f8d85fb38 (tree)
parent a4352982b3ad4370543e0d4486347b58a958ed6b
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sun,  1 Oct 2023 23:04:32 -0700

std.fs: give readLink an explicit error set

Diffstat:
Mlib/std/fs.zig | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 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); }