summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:59:34 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit6046b8c67bf6894824d2b7f72c476b9dfd5daa72 (patch)
tree835675bf66e05a11486d867e88527688de18ca14 /src/pardes.zig
parent8bc8bc2289e3e33903f9008b3513d0bd9c3f7311 (diff)
downloadpardes-6046b8c67bf6894824d2b7f72c476b9dfd5daa72.tar.gz
pardes-6046b8c67bf6894824d2b7f72c476b9dfd5daa72.zip
Errnos that fit: a Dump into a missing DumpDir and a shell that is not there are ENOENT, a GUI-only setting EINVAL
A Dump into a DumpDir not there failed EIO `file not found`; `no shell "x"` read as EIO through a mount; and a GUI-only setting on a terminal, EINVAL in the reply, had no word 9ns reads as EINVAL. Each says so in the words that give its errno: `no such directory`, `not found`, `invalid here`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 35b44871..225dbf9e 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5302,7 +5302,14 @@ pub const Pardes = struct {
pub fn dumpFailed(p: *Pardes, path: []const u8, err: anyerror) void {
var what: [limits.host_path_cap + 8]u8 = undefined;
const operation = std.fmt.bufPrint(&what, "Dump {s}", .{path}) catch "Dump";
- p.reportError(p.active, operation, err);
+ // Into a DumpDir that is not there: said so, ENOENT, as a Save is.
+ const parent = std.fs.path.dirname(path) orelse "/";
+ const no_dir = err == error.FileNotFound or err == error.NotDir or
+ (if (comptime hosted) (if (filesystem.localPath(parent)) |local| !exec.isDirectory(local) else false) else false);
+ if (no_dir) {
+ var said: [limits.host_path_cap + 48]u8 = undefined;
+ p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: no such directory", .{operation}) catch "Dump: no such directory");
+ } else p.reportError(p.active, operation, err);
// In the words the message row has, so the write's err is the one
// record of it (its msg goes: 9p_io, dropMessage).
const said = if (p.panes[p.active]) |pane| pane.msg[0..pane.msg_len] else "Dump failed";