summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 1afb1e24..27cbf383 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5271,8 +5271,16 @@ pub const Pardes = struct {
// The `-%` spelling fs.zig already uses for "make this dirty".
f.saved_revision = f.revision -% 1;
};
- var what: [limits.host_path_cap + 8]u8 = undefined;
- p.reportError(id, std.fmt.bufPrint(&what, "Save {s}", .{path}) catch "Save", err);
+ var what: [limits.host_path_cap + 32]u8 = undefined;
+ // A write into a directory that is not there: said so, in the words
+ // a mount reads as ENOENT.
+ 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)
+ p.reportFailure(id, std.fmt.bufPrint(&what, "Save {s}: no such directory", .{path}) catch "Save: no such directory")
+ else
+ p.reportError(id, std.fmt.bufPrint(&what, "Save {s}", .{path}) catch "Save", err);
const said = if (p.panes[id]) |pane| pane.msg[0..pane.msg_len] else "Save failed";
const kept = @import("Messages.zig").clip(said, p.fs.late_failure.len);
@memcpy(p.fs.late_failure[0..kept.len], kept);