summaryrefslogtreecommitdiff
path: root/core/edit_cmd.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/edit_cmd.zig')
-rw-r--r--core/edit_cmd.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/edit_cmd.zig b/core/edit_cmd.zig
index a87fdfa2..495ec786 100644
--- a/core/edit_cmd.zig
+++ b/core/edit_cmd.zig
@@ -77,9 +77,9 @@ const World = struct {
if (std.mem.eql(u8, f.path, path)) return true;
}
const local = filesystem.localPath(path) orelse return true;
- if (@import("exec.zig").kindOf(local) == .directory) return said(bool, why, "B: {s} is a directory", .{path}) orelse false;
+ if (@import("exec.zig").kindOf(w.p.tape, local) == .directory) return said(bool, why, "B: {s} is a directory", .{path}) orelse false;
var buf: [4096]u8 = undefined;
- if (filesystem.resolveOs(local, &buf) == null) return said(bool, why, "B: {s}: no such file", .{path}) orelse false;
+ if (filesystem.resolveOs(w.p.tape, local, &buf) == null) return said(bool, why, "B: {s}: no such file", .{path}) orelse false;
return true;
}
@@ -92,7 +92,7 @@ const World = struct {
fn open(ctx: *anyopaque, path: []const u8, why: *sam.Why) ?sam.File {
const w: *World = @ptrCast(@alignCast(ctx));
const p = w.p;
- if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory)
+ if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(p.tape, local) == .directory)
return said(sam.File, why, "B: {s} is a directory", .{path});
// A look opens it, or finds it open, where a look would; the
// keyboard stays where the Edit ran.
@@ -112,7 +112,7 @@ const World = struct {
fn read(ctx: *anyopaque, arena: std.mem.Allocator, path: []const u8, why: *sam.Why) ?[]const u8 {
const w: *World = @ptrCast(@alignCast(ctx));
- if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory)
+ if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(w.p.tape, local) == .directory)
return said([]const u8, why, "{s} is a directory", .{path});
const bytes = filesystem.read(w.p, path) catch |err| {
// In the words Get says them (builtins.Get).
@@ -177,7 +177,7 @@ pub fn run(p: *Pardes, id: usize, command: []const u8) void {
var world: World = .{ .p = p, .from = id, .arena = arena };
var why: sam.Why = .{};
var text: pardes.Kind.Buf(260) = .{};
- const res = sam.run(arena, files.items, cur, command, .{ .ctx = &world, .check = World.check, .open = World.open, .read = World.read, .refuseGet = World.refuseGet, .home = p.sessionHome() }, &why) catch |err| switch (err) {
+ const res = sam.run(arena, files.items, cur, command, .{ .ctx = &world, .check = World.check, .open = World.open, .read = World.read, .refuseGet = World.refuseGet, .home = p.sessionHome(), .tape = p.tape }, &why) catch |err| switch (err) {
error.Edit => return p.reportFailure(id, text.print("Edit: {s}", .{why.text()})),
error.OutOfMemory => return p.reportError(id, "Edit", err),
};