| ... | ... | @@ -282,6 +282,13 @@ pub fn createFile(self: Dir, sub_path: [:0]const u8, flags: CreateFlags) !File { |
| 282 | 282 | oflag |= sys.O.CLOEXEC; |
| 283 | 283 | return .{ .fd = @enumFromInt(try sys.openat4(@intFromEnum(self.fd), sub_path.ptr, oflag, flags.mode)) }; |
| 284 | 284 | } |
| 285 | pub fn createFileC(self: Dir, sub_path: []const u8, flags: CreateFlags) !File { |
| 286 | std.debug.assert(sub_path.len <= sys.PATH_MAX); |
| 287 | var buf: [sys.PATH_MAX + 1]u8 = undefined; |
| 288 | @memcpy(buf[0..sub_path.len], sub_path); |
| 289 | buf[sub_path.len] = 0; |
| 290 | return createFile(self, buf[0..sub_path.len :0], flags); |
| 291 | } |
| 285 | 292 | |
| 286 | 293 | pub const CreateFlags = packed struct { |
| 287 | 294 | /// Whether the file will be created with read access. |