diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 11:40:03 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | 2f187232227dde2755a7f2f2ce717f3e1f685f5c (patch) | |
| tree | 0aebb2ad5831e235ab5833b514493878a00faf8c /src/exec.zig | |
| parent | f0fc0be608bb1ee96c20d9f9baaefd2543fed7a2 (diff) | |
| download | pardes-2f187232227dde2755a7f2f2ce717f3e1f685f5c.tar.gz pardes-2f187232227dde2755a7f2f2ce717f3e1f685f5c.zip | |
Recent keeps only files on disk, and its cap never drops an open one
A renamed scratch never saved and a /virtual/ pane were recorded as recent files, and at 200 the oldest entry went even when that file was open. Opens, renames and closes now record a path only when it is a file on this host, and the cap drops the oldest closed entry. A name with a newline is not written to the kept list, where it would read back as two.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/exec.zig')
| -rw-r--r-- | src/exec.zig | 10 |
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. |
