summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 11:48:22 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitfc8e1abf361ab2151109e68e5c88a0ed45650b38 (patch)
treee39977dbf694d185ae5348af5e572c0393320d50 /src/main.zig
parentf7c22573915cd4ecb98ef400b0914949ed07874e (diff)
downloadpardes-fc8e1abf361ab2151109e68e5c88a0ed45650b38.tar.gz
pardes-fc8e1abf361ab2151109e68e5c88a0ed45650b38.zip
pardes NEWFILE in a pane forwards even when its directory is missing, and Save makes the directories
fs.md said FILE must already exist, while `pardes new.txt` in fact forwarded, making a pane named for it that Save creates. With a missing directory (`pardes notes/new.txt`) the launch gave up forwarding and started a nested editor inside the pane. Now the name is made absolute as written and forwarded the same way. A name written to a pane's name file that goes into a directory not there has its Save make the directories, as Config's pane does. A Save <path> into a missing directory still fails ENOENT. The Forwarding section now says what a new FILE does. fs.py launches one into a missing directory and saves it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index 0e2ba954..6bdf2bfd 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -416,7 +416,15 @@ fn nativeMain(init: std.process.Init) !void {
// creates the file from.
const base = std.fs.path.basename(target.path);
if (base.len == 0 or std.mem.eql(u8, base, ".") or std.mem.eql(u8, base, "..")) break :forwarding;
- const dir = pardes.filesystem.resolveOs(std.fs.path.dirname(target.path) orelse ".", &realbuf) orelse break :forwarding;
+ const dir = pardes.filesystem.resolveOs(std.fs.path.dirname(target.path) orelse ".", &realbuf) orelse {
+ // Its directory not there either: the name made absolute as
+ // written, and the pane's Save makes the directories (a
+ // name into a missing one says so, pane.zig writeName).
+ var cwd_buf: [4096]u8 = undefined;
+ if (std.c.getcwd(&cwd_buf, cwd_buf.len) == null) break :forwarding;
+ const cwd = std.mem.sliceTo(&cwd_buf, 0);
+ break :named std.fs.path.resolvePosix(arena, &.{ cwd, target.path }) catch break :forwarding;
+ };
break :named std.fmt.bufPrint(&newbuf, "{s}/{s}", .{ std.mem.trimEnd(u8, dir.path, "/"), base }) catch break :forwarding;
};
if (found_path != null) {