diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 21:25:38 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 21:55:57 -0300 |
| commit | 97efe2d711b8b357157db2cb3402c3488064117a (patch) | |
| tree | 4f3b403578a7116cdc75f60200e85c1410df0dbb /src/builtins.zig | |
| parent | 778de441bc5645bf15ba8d3dff83766fbb70499e (diff) | |
| download | pardes-97efe2d711b8b357157db2cb3402c3488064117a.tar.gz pardes-97efe2d711b8b357157db2cb3402c3488064117a.zip | |
A refused Putall is answered once the other saves have landed; a bad Tab width is invalid (EINVAL), from a pane's exec too; Incl refuses a relative or missing directory and takes - only alone
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 129dd659..70ca93a1 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1191,6 +1191,20 @@ pub const Incl = struct { p.incl.clearRetainingCapacity(); return p.setMessage(c.id, "Incl: none"); } + // All checked before any is taken: `-` clears, alone; a directory + // is absolute (or ~) and there. + var check = std.mem.tokenizeAny(u8, typed, " \t"); + while (check.next()) |dir_word| { + var said: [320]u8 = undefined; + const shown = dir_word[0..@min(dir_word.len, 200)]; + if (std.mem.eql(u8, dir_word, "-")) return p.reportFailure(c.id, "Incl: invalid: - clears the list, alone"); + if (dir_word[0] != '/' and dir_word[0] != '~') + return p.reportFailure(c.id, std.fmt.bufPrint(&said, "Incl: invalid directory: {s} is relative", .{shown}) catch "Incl: invalid directory"); + var home_buf: [4096]u8 = undefined; + const expanded = @import("fs.zig").expandHome(dir_word, &home_buf); + if (comptime pardes.hosted) if (@import("fs.zig").localPath(expanded)) |local| if (!exec.isDirectory(local)) + return p.reportFailure(c.id, std.fmt.bufPrint(&said, "Incl: no such directory: {s}", .{shown}) catch "Incl: no such directory"); + } var words = std.mem.tokenizeAny(u8, typed, " \t"); while (words.next()) |dir_word| { var home_buf: [4096]u8 = undefined; |
