From 7e6fc8c9f62bc3dc08e24856cc647fa0adefb32c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 9 Nov 2026 03:31:45 -0300 Subject: idioms: std.Io's names for the std.fs aliases left in Addon, Kind, rollback and replica (std.Io.Dir.path, std.Io.Dir.max_path_bytes), and the window's handover dump written and removed through the shell's io (Io.Dir.writeFile at 0600, deleteFile) instead of libc open, write and unlink Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Addon.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Addon.zig') diff --git a/src/Addon.zig b/src/Addon.zig index fa41f774..cadf28d7 100644 --- a/src/Addon.zig +++ b/src/Addon.zig @@ -206,7 +206,7 @@ pub fn scan() []const Loaded { if (data.len > 0) scanDir(data, std.fmt.bufPrint(&dir_buf, "{s}/addons", .{data}) catch "", crashed.slice()); var exe: [4096]u8 = undefined; const n = std.c.readlink("/proc/self/exe", &exe, exe.len); - if (n > 0) if (std.fs.path.dirname(exe[0..@intCast(n)])) |bin| if (std.fs.path.dirname(bin)) |prefix| + if (n > 0) if (std.Io.Dir.path.dirname(exe[0..@intCast(n)])) |bin| if (std.Io.Dir.path.dirname(bin)) |prefix| scanDir(data, std.fmt.bufPrint(&dir_buf, "{s}/lib/pardes/addons", .{prefix}) catch "", crashed.slice()); return found[0..nfound]; } @@ -506,7 +506,7 @@ pub fn run(p: *Pardes, id: usize, arg: ?[]const u8) void { var target: [pardes.effect_path_cap]u8 = undefined; if (op == .load) { const dir = std.mem.trimEnd(u8, if (p.panes[id]) |pane| Pardes.paneDir(pane) else p.sessionDir(), "/"); - const path = if (std.fs.path.isAbsolute(rest)) rest else std.fmt.bufPrint(&target, "{s}/{s}", .{ dir, rest }) catch return p.reportFailure(id, "Addon: that path is too long"); + const path = if (std.Io.Dir.path.isAbsolute(rest)) rest else std.fmt.bufPrint(&target, "{s}/{s}", .{ dir, rest }) catch return p.reportFailure(id, "Addon: that path is too long"); if (path.len > pardes.effect_path_cap) return p.reportFailure(id, "Addon: that path is too long"); return p.emit(.{ .addon = .{ .op = .load, .pane = @intCast(id), .arg = .from(path) } }); } @@ -540,7 +540,7 @@ pub fn openPanes(p: *const Pardes, name: []const u8) usize { pub fn landed(p: *Pardes, op: Op, pane: u8, l: Loaded) void { const id = if (pane < p.panes.len and p.panes[pane] != null) pane else p.view().active; var said: [320]u8 = undefined; - const base = std.fs.path.basename(l.path); + const base = std.Io.Dir.path.basename(l.path); if (op == .reload) { var why: Why = .{}; if (!swap(p, l, &why)) { @@ -651,7 +651,7 @@ fn fail(why: *Why, comptime fmt: []const u8, args: anytype) bool { /// loaded|refused: why` a line (`-` for no path, no hash). pub fn list(p: *const Pardes, out: *std.ArrayList(u8), gpa: std.mem.Allocator) !void { for (p.kinds.kinds[0..p.kinds.n]) |*e| { - const name = if (e.nameOf().len > 0) e.nameOf() else std.fs.path.basename(e.path.slice()); + const name = if (e.nameOf().len > 0) e.nameOf() else std.Io.Dir.path.basename(e.path.slice()); try out.print(gpa, "{s} {d} {d}.{d} {d} {s} ", .{ name, e.version, e.abi >> 16, e.abi & 0xffff, if (e.refused) 0 else openPanes(p, name), if (e.path.len > 0) e.path.slice() else "-" }); if (std.mem.allEqual(u8, &e.hash, 0)) try out.append(gpa, '-') else try out.print(gpa, "{x}", .{e.hash}); try out.print(gpa, " {s}\n", .{e.why.slice()}); -- cgit v1.3