| ... | @@ -94,3 +94,13 @@ pub fn makePath(self: Dir, sub_path: [:0]const u8) !void { | ... | @@ -94,3 +94,13 @@ pub fn makePath(self: Dir, sub_path: [:0]const u8) !void { |
| 94 | component = it.next() orelse return; | 94 | component = it.next() orelse return; |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| | 97 | |
| | 98 | pub 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 | } |