From 77671575bd2f481651ea54e956ac5c7da8d63710 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 12:14:58 -0300 Subject: idioms #1, std.fs's deprecated aliases in the hosts: std.fs.path and std.fs.max_path_bytes are std.Io.Dir.path and std.Io.Dir.max_path_bytes in 0.17, so the hosts name them there Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/dump.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/dump.zig') diff --git a/src/dump.zig b/src/dump.zig index 0507fb4f..ba159325 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -52,8 +52,8 @@ pub fn directory(buf: []u8, dir_setting: []const u8) ?[]const u8 { var fba_buf: [4096]u8 = undefined; var fba = std.heap.FixedBufferAllocator.init(&fba_buf); var cwd_buf: [1024]u8 = undefined; - const cwd: []const u8 = if (std.fs.path.isAbsolute(raw)) "/" else if (std.c.getcwd(&cwd_buf, cwd_buf.len)) |c| std.mem.span(@as([*:0]const u8, @ptrCast(c))) else "/"; - const resolved = std.fs.path.resolvePosix(fba.allocator(), &.{ cwd, raw }) catch return null; + const cwd: []const u8 = if (std.Io.Dir.path.isAbsolute(raw)) "/" else if (std.c.getcwd(&cwd_buf, cwd_buf.len)) |c| std.mem.span(@as([*:0]const u8, @ptrCast(c))) else "/"; + const resolved = std.Io.Dir.path.resolvePosix(fba.allocator(), &.{ cwd, raw }) catch return null; return std.fmt.bufPrint(buf, "{s}", .{resolved}) catch null; } @@ -62,7 +62,7 @@ test "a DumpDir reads back absolute, however it was written" { try std.testing.expectEqualStrings("/tmp/dumps", directory(&buf, "/tmp/dumps/").?); try std.testing.expectEqualStrings("/tmp/dumps", directory(&buf, "/tmp//x/../dumps").?); const rel = directory(&buf, "rel/"); - try std.testing.expect(std.fs.path.isAbsolute(rel.?) and std.mem.endsWith(u8, rel.?, "/rel")); + try std.testing.expect(std.Io.Dir.path.isAbsolute(rel.?) and std.mem.endsWith(u8, rel.?, "/rel")); } /// The standard dump directory, without creating it or generating a filename. @@ -139,7 +139,7 @@ pub fn dumpTo(p: *Pardes, to: ?[]const u8) !void { pub fn restoreFile(name: []const u8, dir_setting: []const u8, out: *[4096]u8) ?[]const u8 { const path = filesystem.restorePath(name, dir_setting, out); if (std.mem.indexOfScalar(u8, name, '/') != null or std.mem.startsWith(u8, name, "~")) return path; - return if (std.fs.path.isAbsolute(path)) path else null; + return if (std.Io.Dir.path.isAbsolute(path)) path else null; } /// What a Restore of `name` reads, `gpa`'s: the file it names (an image, -- cgit v1.3