From fc341bcc52aebe7acc079179e0b46e231dc43053 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 8 May 2026 00:28:15 -0700 Subject: [PATCH] add Dir.access() --- Dir.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Dir.zig b/Dir.zig index 3cfb13660b921f431c4123f943af3d4b9c5e0808..75d0898e18788e4394c5fddc6ffbc23bf5e1f267 100644 --- a/Dir.zig +++ b/Dir.zig @@ -279,3 +279,14 @@ pub const CreateFlags = packed struct { /// The file system mode the file will be created with. mode: File.Mode = 0o666, }; + +pub fn access(self: Dir, sub_path: [:0]const u8, amode: AccessMode, flag: c_int) !void { + return sys.faccessat(@intFromEnum(self.fd), sub_path, @bitCast(amode), flag); +} + +pub const AccessMode = packed struct(c_uint) { + readable: bool = false, + writable: bool = false, + executable: bool = false, + _: u29 = 0, +}; -- 2.54.0