| ... | @@ -80,6 +80,13 @@ pub fn makeDir(self: Dir, sub_path: [:0]const u8) !void { | ... | @@ -80,6 +80,13 @@ pub fn makeDir(self: Dir, sub_path: [:0]const u8) !void { |
| 80 | pub fn statFile(self: Dir, sub_path: [:0]const u8) !File.Stat { | 80 | pub fn statFile(self: Dir, sub_path: [:0]const u8) !File.Stat { |
| 81 | return .fromPosix(try sys.fstatat(@intFromEnum(self.fd), sub_path, 0)); | 81 | return .fromPosix(try sys.fstatat(@intFromEnum(self.fd), sub_path, 0)); |
| 82 | } | 82 | } |
| | 83 | pub fn statFileC(self: Dir, sub_path: []const u8) !File.Stat { |
| | 84 | std.debug.assert(sub_path.len <= sys.NAME_MAX); |
| | 85 | var buf: [sys.NAME_MAX + 1]u8 = undefined; |
| | 86 | @memcpy(buf[0..sub_path.len], sub_path); |
| | 87 | buf[sub_path.len] = 0; |
| | 88 | return statFile(self, buf[0..sub_path.len :0]); |
| | 89 | } |
| 83 | | 90 | |
| 84 | pub fn makePath(self: Dir, sub_path: [:0]const u8) !void { | 91 | pub fn makePath(self: Dir, sub_path: [:0]const u8) !void { |
| 85 | var it = try std.fs.path.componentIterator(sub_path); | 92 | var it = try std.fs.path.componentIterator(sub_path); |