aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-06-20 19:46:14 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-06-20 19:46:14 -0400
commit0a9672fb86b84658f8780f57e769be45e41f3034 (patch)
tree32a49700828436b19b56e1502b81c8d795ec63a1 /lib
parentda549a72e19d4f24520ca151bbd4cd0e74dc752c (diff)
downloadzig-0a9672fb86b84658f8780f57e769be45e41f3034.tar.gz
zig-0a9672fb86b84658f8780f57e769be45e41f3034.zip
rework zig fmt to avoid unnecessary realpath() calls
* add `std.fs.Dir.stat` * zig fmt checks for sym link loops using inodes instead of using realpath
Diffstat (limited to 'lib')
-rw-r--r--lib/std/fs.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index fa782b14c0..dfd58de500 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -1545,6 +1545,17 @@ pub const Dir = struct {
return AtomicFile.init(dest_path, options.mode, self, false);
}
}
+
+ pub const Stat = File.Stat;
+ pub const StatError = File.StatError;
+
+ pub fn stat(self: Dir) StatError!Stat {
+ const file: File = .{
+ .handle = self.fd,
+ .capable_io_mode = .blocking,
+ };
+ return file.stat();
+ }
};
/// Returns an handle to the current working directory. It is not opened with iteration capability.