diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 12:14:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 14:56:36 -0300 |
| commit | 77671575bd2f481651ea54e956ac5c7da8d63710 (patch) | |
| tree | def07749c63bdc279e0119d58101aa1399dd5cf3 /src/dump.zig | |
| parent | b5bb5e8ccf71a5755dde95f04440ee9c6aaa18da (diff) | |
| download | pardes-77671575bd2f481651ea54e956ac5c7da8d63710.tar.gz pardes-77671575bd2f481651ea54e956ac5c7da8d63710.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 8 |
1 files changed, 4 insertions, 4 deletions
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, |
