diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 14:02:59 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | b43866d6ab784e518df8dbef374147367358ada9 (patch) | |
| tree | b49ffadf36cac764cb3fb6f4d343fa25d09dab73 /src/ninep/pane.zig | |
| parent | 9ca008a27c4ab83a29c1798f4eb081eef372624c (diff) | |
| download | pardes-b43866d6ab784e518df8dbef374147367358ada9.tar.gz pardes-b43866d6ab784e518df8dbef374147367358ada9.zip | |
Save makes the directories its file goes in, always: for the pane's own name and Save path alike
Whether a Save made missing directories depended on how the name had
come about. Config's pane did, a name written into a missing directory did
(since kkrqxtsp), and `Save path` and every other name did not, failing
ENOENT instead. There is now one rule: a Save makes the parent
directories of the file it writes, a pane's own or a terminal's
scrollback included, and the make_dirs flag is gone. A directory it
cannot make still fails the write with why, as fs.py's
/nonexistent-pardes-dir case shows. fs.py now also saves into missing
directories by Save path and by a written name.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 6a0fbba5..de7f7cd4 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -867,11 +867,6 @@ fn writeName(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply { error.OutOfMemory => E.NOMEM, else => E.INVAL, }); - // A name into a directory not there yet asks for it, as Config's pane - // does: its Save makes the directories (`pardes new/dir/f` forwarded). - if (comptime pardes.hosted) if (fs.localPath(std.fs.path.dirname(full) orelse "/")) |local| { - if (!exec.isDirectory(local)) fileOf(pane).?.make_dirs = true; - }; return .{ .tag = req.tag, .written = @intCast(req.data.len) }; } @@ -1392,19 +1387,6 @@ test "a name with a component over 255 bytes is refused, and a long path's faile try testing.expect(std.mem.endsWith(u8, late, "/f.txt: no such directory")); } -test "a name into a directory not there has Save make it; one into a directory there does not" { - if (comptime !pardes.hosted) return error.SkipZigTest; - const p = try withFile(testing.allocator, "x\n"); - defer p.deinit(); - const serial = serialOf(p); - const f = fileOf(p.panes[p.paneBySerial(serial).?].?).?; - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/pardes-no-such-dir-mk/sub/f.txt\n").reply.status); - try testing.expect(f.make_dirs); - f.make_dirs = false; - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/f.txt\n").reply.status); - try testing.expect(!f.make_dirs); -} - test "a name cut across writes is one name, applied once at its newline or its close" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); |
