authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 13:54:05 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 13:54:05 -07:00
log3c33f01135c194c99e70da5995cbdf938042a464
tree5f98d586365fa8f3cfce91ddfecf342c20286ce9
parentc6c099e2907e39aacc8bb11bd271861379faa585
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

Dir: add createFileC


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

Dir.zig+7
......@@ -282,6 +282,13 @@ pub fn createFile(self: Dir, sub_path: [:0]const u8, flags: CreateFlags) !File {
282282 oflag |= sys.O.CLOEXEC;
283283 return .{ .fd = @enumFromInt(try sys.openat4(@intFromEnum(self.fd), sub_path.ptr, oflag, flags.mode)) };
284284}
285pub 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}
285292
286293pub const CreateFlags = packed struct {
287294 /// Whether the file will be created with read access.