Commit 309c53295f

Andrew Kelley <andrew@ziglang.org>
2023-10-02 08:04:32
std.fs: give readLink an explicit error set
1 parent a435298
Changed files (1)
lib
std
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);
         }