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/Db.zig | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Db.zig') diff --git a/src/Db.zig b/src/Db.zig index b79bf315..27557ac4 100644 --- a/src/Db.zig +++ b/src/Db.zig @@ -138,7 +138,7 @@ fn openDisk(gpa: std.mem.Allocator, path: []const u8) !*Open { defer pardes.turn.back(); const io = ioOf(); const cwd = std.Io.Dir.cwd(); - if (std.fs.path.dirname(path)) |dir| try cwd.createDirPath(io, dir); + if (std.Io.Dir.path.dirname(path)) |dir| try cwd.createDirPath(io, dir); const o = try gpa.create(Open); errdefer gpa.destroy(o); o.* = .{ .gpa = gpa, .buffer = .init(gpa), .where = undefined }; @@ -909,7 +909,7 @@ pub const Cache = struct { std.fmt.bufPrint(&c.path_buf, "{s}/.cache/pardes/" ++ name, .{std.mem.span(home)}) else return null) catch return null; - std.Io.Dir.cwd().createDirPath(io, std.fs.path.dirname(where).?) catch return null; + std.Io.Dir.cwd().createDirPath(io, std.Io.Dir.path.dirname(where).?) catch return null; c.path_len = where.len; return c; } @@ -1142,7 +1142,7 @@ fn testWindow(dir: []const u8) !*Pardes { return Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48, .state = .disk, .startup_config = try std.fmt.bufPrint(&config, "DumpDir {s}\n", .{dir}) }); } -fn testDir(tmp: *std.testing.TmpDir, buf: *[std.fs.max_path_bytes]u8) ![]const u8 { +fn testDir(tmp: *std.testing.TmpDir, buf: *[std.Io.Dir.max_path_bytes]u8) ![]const u8 { return buf[0..try tmp.dir.realPath(testing.io, buf)]; } @@ -1156,7 +1156,7 @@ fn fileSize(dir: []const u8) u64 { test "state file: two windows share Recent, each reading the other's commits on use; a busy lock delays, never loses" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - var dir_buf: [std.fs.max_path_bytes]u8 = undefined; + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; const dir = try testDir(&tmp, &dir_buf); const a = try testWindow(dir); defer a.deinit(); @@ -1202,7 +1202,7 @@ test "state file: two windows share Recent, each reading the other's commits on test "state file: Recent holds the newest 200, the newest first, and a window started on it reads them so" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - var dir_buf: [std.fs.max_path_bytes]u8 = undefined; + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; const dir = try testDir(&tmp, &dir_buf); const a = try testWindow(dir); defer a.deinit(); @@ -1228,7 +1228,7 @@ test "state file: Recent holds the newest 200, the newest first, and a window st test "state file: one that is no database of pardes's never stops pardes: it is kept aside, and a new one started" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - var dir_buf: [std.fs.max_path_bytes]u8 = undefined; + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; const dir = try testDir(&tmp, &dir_buf); try tmp.dir.writeFile(testing.io, .{ .sub_path = file_name, .data = "\x00\xffnot a database at all\n7 3 0 0 /w/ok.zig\n" }); const a = try testWindow(dir); @@ -1249,7 +1249,7 @@ test "state file: one a power loss tore is opened at its last whole commit, the if (std.c.getenv("PARDES_DUMP") != null) return error.SkipZigTest; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - var dir_buf: [std.fs.max_path_bytes]u8 = undefined; + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; const dir = try testDir(&tmp, &dir_buf); var label_buf: [64]u8 = undefined; var label: []const u8 = undefined; @@ -1335,7 +1335,7 @@ test "state file: a Dump makes every directory missing on the way to its DumpDir if (std.c.getenv("PARDES_DUMP") != null) return error.SkipZigTest; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - var dir_buf: [std.fs.max_path_bytes]u8 = undefined; + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; const base = try testDir(&tmp, &dir_buf); var setting: [4200]u8 = undefined; const dir = try std.fmt.bufPrint(&setting, "{s}/fresh/.local/share/pardes", .{base}); @@ -1352,7 +1352,7 @@ test "state file: a Dump makes every directory missing on the way to its DumpDir test "state file: Recent is read once from the file it replaced, else from the store before that, both left where they are" { var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - var dir_buf: [std.fs.max_path_bytes]u8 = undefined; + var dir_buf: [std.Io.Dir.max_path_bytes]u8 = undefined; const dir = try testDir(&tmp, &dir_buf); try tmp.dir.createDirPath(testing.io, "old"); try tmp.dir.createDirPath(testing.io, "older"); -- cgit v1.3