summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-03 13:11:24 -0300
committerGabriel Schneider <[email protected]>2026-09-03 13:11:24 -0300
commit7c6165f184e45af30ac697f8e8a584529ac4a287 (patch)
treea03b6bc02ba77c7abe503a304370a59fd9a17e9c /src/main.zig
parente81b63106b83bce66641e8dd27d6aa348252baf1 (diff)
downloadpardes-7c6165f184e45af30ac697f8e8a584529ac4a287.tar.gz
pardes-7c6165f184e45af30ac697f8e8a584529ac4a287.zip
boot: argv naming nothing opens an errors pane, not a stack trace
`pardes nosuchfile` returned error.BadArgs out of nativeMain, which std prints as `error: BadArgs` with a return trace under it — indistinguishable from a crash, for a typo, and it left the human with no editor at all. A launch that names something look.resolve cannot make a target of now boots one +Errors pane filling the window, saying `file or directory not found` and the argument AS TYPED: acme's own vocabulary for output that came from the program rather than from a word somebody clicked, and the word rather than a resolved path because `pardes ~/notes/tdoo.md` wants to see its own typo back. A chdir that fails on a directory that really is one stays BadArgs. That is a permission problem rather than a typo, and the two want different answers. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016Q4RATpafkwahrovHQLKRf
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index 41495a48..60491052 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -333,6 +333,14 @@ fn nativeMain(init: std.process.Init) !void {
opts.file_line = t.at.line;
},
.image => |t| opts.file = try arena.dupe(u8, t.path),
+ // Nothing of that name is there. A typo is not a reason to
+ // refuse to start: the session boots with one `+Errors` pane
+ // naming what was asked for (pardes.zig `missing_path`). The
+ // other arms stay `BadArgs` — a `.dir` here means `chdir`
+ // refused a directory that IS one, which is a permission
+ // problem and not a typo, and `.url`/`.pane` are targets no
+ // launch can act on.
+ .none => opts.missing_path = try arena.dupe(u8, a),
else => return error.BadArgs,
}
}