summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 11:43:08 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit261eb7ac3f090c8ce47ad47c0f58f824a9b162a6 (patch)
tree0db277a1100324582393b0595e598b6c49d2015a /src/exec.zig
parent2f187232227dde2755a7f2f2ce717f3e1f685f5c (diff)
downloadpardes-261eb7ac3f090c8ce47ad47c0f58f824a9b162a6.tar.gz
pardes-261eb7ac3f090c8ce47ad47c0f58f824a9b162a6.zip
A Dump into a DumpDir that is no directory says so; the doc says a missing last directory is made
DumpDir /dev/null said no such directory though it is there, and the doc claimed a missing DumpDir always fails, where its last component is made at the Dump. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/exec.zig b/src/exec.zig
index fdb9bdb7..683b2f04 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -397,12 +397,18 @@ pub fn isDirectory(path: []const u8) bool {
/// Whether `path` is a plain file on this host, the turn out while it asks.
pub fn isFile(path: []const u8) bool {
+ return kindOf(path) == .file;
+}
+
+/// What `path` is on this host, null when it is not there; the turn out
+/// while it asks.
+pub fn kindOf(path: []const u8) ?std.Io.File.Kind {
var buf: [4096]u8 = undefined;
- const z = std.fmt.bufPrintSentinel(&buf, "{s}", .{path}, 0) catch return false;
+ const z = std.fmt.bufPrintSentinel(&buf, "{s}", .{path}, 0) catch return null;
pardes.turn.yield();
defer pardes.turn.back();
- const stat = std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), z, .{}) catch return false;
- return stat.kind == .file;
+ const stat = std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), z, .{}) catch return null;
+ return stat.kind;
}
/// With `BootShell replace`, a doc landing in `col` closes a lone pristine