authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-10 01:40:29 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-10 01:40:29 -07:00
log0e6c256cd96af224511210d877acef60ac07484f
treefc4fa0eaa1befbc44823f203417422d4fb08ff29
parent41878815ba2fb2ae28194e482ae05629e4ffb79d
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

add dup() methods


2 files changed, 8 insertions(+), 0 deletions(-)

Dir.zig+4
...@@ -453,3 +453,7 @@ pub fn copyFile(source_dir: Dir, source_path: [:0]const u8, dest_dir: Dir, dest_...@@ -453,3 +453,7 @@ pub fn copyFile(source_dir: Dir, source_path: [:0]const u8, dest_dir: Dir, dest_
453 return;453 return;
454 }454 }
455}455}
456
457pub fn dup(self: Dir) !Dir {
458 return .{ .fd = @enumFromInt(try sys.dup(@intFromEnum(self.fd))) };
459}
File.zig+4
...@@ -230,3 +230,7 @@ pub fn realpathAlloc(self: File, allocator: std.mem.Allocator) ![:0]u8 {...@@ -230,3 +230,7 @@ pub fn realpathAlloc(self: File, allocator: std.mem.Allocator) ![:0]u8 {
230 const actual = try self.realpath(&buf);230 const actual = try self.realpath(&buf);
231 return allocator.dupeZ(u8, actual);231 return allocator.dupeZ(u8, actual);
232}232}
233
234pub fn dup(self: File) !File {
235 return .{ .fd = @enumFromInt(try sys.dup(@intFromEnum(self.fd))) };
236}