authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-28 22:19:09 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-28 22:19:09 -08:00
logb31c8f71fa44e38c842898c85c37d495cd9a5e1c
treeaa38aea648e2809accb6cf36729659982375dad1
parentfc99d96ee5bccb61b06c94470ae0ef5f930e0df2

Dir: add makeOpenPath


1 files changed, 10 insertions(+), 0 deletions(-)

Dir.zig+10
......@@ -94,3 +94,13 @@ pub fn makePath(self: Dir, sub_path: [:0]const u8) !void {
9494 component = it.next() orelse return;
9595 }
9696}
97
98pub fn makeOpenPath(self: Dir, sub_path: [:0]const u8, flags: OpenDirFlags) !Dir {
99 return self.openDir(sub_path, flags) catch |err| switch (err) {
100 error.ENOENT => {
101 try self.makePath(sub_path);
102 return self.openDir(sub_path, flags);
103 },
104 else => |e| return e,
105 };
106}