summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 03:31:45 -0300
committerGabriel Schneider <[email protected]>2026-11-09 03:31:45 -0300
commit7e6fc8c9f62bc3dc08e24856cc647fa0adefb32c (patch)
tree354ff35a205535ee35f9fa272639206e16ab0cec /src/gui
parent5de9d27458cd8ff7e326532e8923c933e141ea7f (diff)
downloadpardes-7e6fc8c9f62bc3dc08e24856cc647fa0adefb32c.tar.gz
pardes-7e6fc8c9f62bc3dc08e24856cc647fa0adefb32c.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.zig15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 212fe5ad..4e1f76dc 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -3570,16 +3570,15 @@ fn handOver(ctx: ?*anyopaque, seq: u32, bytes: []const u8) void {
const s = shellOf(ctx);
const Handover = pardes.Handover;
const path = Handover.dumpPath(s.gpa, seq) catch |err| return s.core.update(.{ .handed = .{ .seq = seq, .failure = @errorName(err) } });
- const fd = libc.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true, .CLOEXEC = true }, @as(libc.mode_t, 0o600));
- const written = fd >= 0 and host_io.writeFd(fd, bytes);
- if (fd >= 0) _ = libc.close(fd);
- if (!written) {
- _ = libc.unlink(path);
+ // A dump not written, or not carried, goes: what failed is said.
+ const cwd = std.Io.Dir.cwd();
+ cwd.writeFile(s.io, .{ .sub_path = path, .data = bytes, .flags = .{ .permissions = .fromMode(0o600) } }) catch {
+ cwd.deleteFile(s.io, path) catch {};
s.gpa.free(path);
return s.core.update(.{ .handed = .{ .seq = seq, .failure = "cannot write its dump" } });
- }
+ };
const job = s.gpa.create(Handover.Job) catch {
- _ = libc.unlink(path);
+ cwd.deleteFile(s.io, path) catch {};
s.gpa.free(path);
return s.core.update(.{ .handed = .{ .seq = seq, .failure = "out of memory" } });
};
@@ -3603,7 +3602,7 @@ fn handOver(ctx: ?*anyopaque, seq: u32, bytes: []const u8) void {
job.geometry_len = geometry.len;
}
s.core.handover.start(s.io, job) catch |err| {
- _ = libc.unlink(path);
+ cwd.deleteFile(s.io, path) catch {};
s.gpa.free(path);
s.gpa.destroy(job);
return s.core.update(.{ .handed = .{ .seq = seq, .failure = @errorName(err) } });