summaryrefslogtreecommitdiff
path: root/src/exec.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/exec.zig')
-rw-r--r--src/exec.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/exec.zig b/src/exec.zig
index 0e9fb6d7..fdb9bdb7 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -395,6 +395,16 @@ pub fn isDirectory(path: []const u8) bool {
return stat.kind == .directory;
}
+/// Whether `path` is a plain file on this host, the turn out while it asks.
+pub fn isFile(path: []const u8) bool {
+ var buf: [4096]u8 = undefined;
+ const z = std.fmt.bufPrintSentinel(&buf, "{s}", .{path}, 0) catch return false;
+ 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;
+}
+
/// With `BootShell replace`, a doc landing in `col` closes a lone pristine
/// shell there, the boot's placeholder, and absorbVWeight hands its space to
/// the doc. With `keep`, the default, the shell stays like any other pane.