diff options
Diffstat (limited to 'core/Core.zig')
| -rw-r--r-- | core/Core.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/Core.zig b/core/Core.zig index 5bb0809e..3876b3e8 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -715,9 +715,9 @@ pub fn loadRecent(p: *Pardes) void { /// Whether `path` is one Recent keeps: a file on this host's disk, not /// the served tree's (`/virtual/`) nor a name never saved. -pub fn recentKeeps(path: []const u8) bool { +pub fn recentKeeps(tape: *pardes.tape.Tape, path: []const u8) bool { const local = filesystem.localPath(path) orelse return false; - return exec.kindOf(local) == .file; + return exec.kindOf(tape, local) == .file; } /// A file pane or a kind's (a PDF, a picture) closing: its place noted in Recent, when @@ -1397,12 +1397,12 @@ fn missingInterpreter(bin: []const u8, out: []u8) ?[]const u8 { /// The directory a write of `path` that failed with `err` went into: /// what is there (a directory when it is no local path), whether it is /// missing, and whether that is because one above refuses (EACCES). -fn parentTrouble(path: []const u8, err: anyerror) struct { dir: []const u8, kind: ?std.Io.File.Kind, missing: bool, denied: bool } { +fn parentTrouble(tape: *pardes.tape.Tape, path: []const u8, err: anyerror) struct { dir: []const u8, kind: ?std.Io.File.Kind, missing: bool, denied: bool } { const dir = std.Io.Dir.path.dirname(path) orelse "/"; const local = filesystem.localPath(dir); - const kind: ?std.Io.File.Kind = if (local) |l| exec.kindOf(l) else .directory; + const kind: ?std.Io.File.Kind = if (local) |l| exec.kindOf(tape, l) else .directory; const missing = err == error.FileNotFound or err == error.NotDir or kind != .directory; - const denied = missing and (if (local) |l| pardes.tape.value(.denied, filesystem.deniedAbove, .{l}) else false); + const denied = missing and (if (local) |l| tape.value(.denied, filesystem.deniedAbove, .{l}) else false); return .{ .dir = dir, .kind = kind, .missing = missing, .denied = denied }; } @@ -1416,7 +1416,7 @@ pub fn saveFailed(p: *Pardes, id: u8, path: []const u8, err: anyerror) void { var what: pardes.Kind.Buf(limits.host_path_cap + 32) = .{}; // A write into a directory that is not there: said so, in the words // a mount reads as ENOENT; EACCES when one above refuses. - const parent = parentTrouble(path, err); + const parent = parentTrouble(p.tape, path, err); if (parent.denied) p.reportFailure(id, what.print("Save {s}: permission denied", .{path[0..@min(path.len, limits.host_path_cap)]})) else if (parent.missing) @@ -1437,7 +1437,7 @@ pub fn dumpFailed(p: *Pardes, path: []const u8, err: anyerror) void { const operation = std.fmt.bufPrint(&what, "Dump {s}", .{path[0..@min(path.len, limits.host_path_cap)]}) catch unreachable; // cap + 5 fits cap + 8 // Into a DumpDir that is not there: said so, ENOENT, as a Save is; // one that is there but no directory (`/dev/null`) says that. - const parent = parentTrouble(path, err); + const parent = parentTrouble(p.tape, path, err); var said: pardes.Kind.Buf(limits.host_path_cap + 48) = .{}; if (parent.denied and parent.kind == null) p.reportFailure(v.active, said.print("{s}: permission denied", .{operation})) @@ -1792,7 +1792,7 @@ pub fn sessionShell(p: *const Pardes) []const u8 { /// A path's leading `~` (alone, or before `/` or `:`) as the session's home; /// `~user` that user's (fs.expandHomeFrom). pub fn expandHome(p: *const Pardes, path: []const u8, out: *[4096]u8) []const u8 { - return filesystem.expandHomeFrom(path, out, p.sessionHome()); + return filesystem.expandHomeFrom(p.tape, path, out, p.sessionHome()); } /// The session's home, null for none. |
