diff options
Diffstat (limited to 'src/edit_cmd.zig')
| -rw-r--r-- | src/edit_cmd.zig | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/edit_cmd.zig b/src/edit_cmd.zig index 8bde605b..517f2e8d 100644 --- a/src/edit_cmd.zig +++ b/src/edit_cmd.zig @@ -76,7 +76,6 @@ const World = struct { const f = ninep_pane.fileOf(pane) orelse continue; if (std.mem.eql(u8, f.path, path)) return true; } - if (comptime !pardes.hosted) 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; var buf: [4096]u8 = undefined; @@ -93,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 (comptime pardes.hosted) if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory) + if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(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. @@ -113,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 (comptime pardes.hosted) if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(local) == .directory) + if (filesystem.localPath(path)) |local| if (@import("exec.zig").kindOf(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). @@ -237,7 +236,7 @@ pub fn run(p: *Pardes, id: usize, command: []const u8) void { .token = selection_pipe.newToken(), // What a pane's command is given: $PARDES_MOUNT, $PARDES_9P, // $PARDES_PID, $winid as the Edit's pane. - .env = if (comptime pardes.hosted) @import("host_io.zig").commandEnv(arena, pane.serial, !p.opts.nested) catch &.{} else &.{}, + .env = @import("host_io.zig").commandEnv(arena, pane.serial, !p.opts.nested) catch &.{}, }; keep = true; p.pipe.edit_run = pd; @@ -559,7 +558,6 @@ test "the held write asked again is parked again, then answered once, and a flus } test "Edit's < | and > with a real shell: a command per address, > printed to +Errors" { - if (comptime !pardes.hosted) return error.SkipZigTest; const p = try th.withFile(testing.allocator, "one two\nthree\n"); defer p.deinit(); const ctl = tree.Node.of(th.serialOf(p), .ctl); @@ -580,7 +578,6 @@ test "Edit's < | and > with a real shell: a command per address, > printed to +E } test "a failing command changes nothing and says why, its stderr in +Errors" { - if (comptime !pardes.hosted) return error.SkipZigTest; const p = try th.withFile(testing.allocator, "keep\n"); defer p.deinit(); const ctl = tree.Node.of(th.serialOf(p), .ctl); @@ -609,7 +606,7 @@ test "an Edit whose file is edited while its commands run is refused whole" { } test "X over open files, w, e, r, f, B and D on panes and the disk" { - if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest; + if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; const gpa = testing.allocator; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); @@ -686,7 +683,7 @@ test "X over open files, w, e, r, f, B and D on panes and the disk" { } test "an Edit's w to a file changed on disk is refused once, as Save is, and the others are written" { - if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest; + if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "a\n" }); @@ -722,7 +719,7 @@ test "an Edit's w to a file changed on disk is refused once, as Save is, and the } test "an Edit with no command runs beside one whose commands run, unless it touches what that one changes" { - if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest; + if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "other.txt", .data = "x\n" }); @@ -783,7 +780,7 @@ test "a session that ends while an Edit's commands run lets the Edit go" { } test "e and r say a file that cannot be read as Get says it" { - if (comptime !pardes.hosted or !filesystem.platform_has_fs) return error.SkipZigTest; + if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const ctl = tree.Node.of(th.serialOf(p), .ctl); |
