summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/config.zig b/src/config.zig
index b6eb4520..cc46adfc 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -1148,8 +1148,18 @@ pub const Runtime = struct {
if (percent > 100) return false;
state.window_blur = percent;
},
- // Bare, it returns to the default directory.
- .dump_dir => if (!state.dump_dir.set(std.mem.trim(u8, argument orelse "", " \t\r\n"))) return false,
+ // Bare, it returns to the default directory. Else an absolute or
+ // `~` path, to a directory there or to be made, that may be
+ // written: a Dump there could never be, refused now.
+ .dump_dir => {
+ const text = std.mem.trim(u8, argument orelse "", " \t\r\n");
+ if (text.len > 0) {
+ if (text[0] != '/' and text[0] != '~') return false;
+ var home_buf: [4096]u8 = undefined;
+ if (pardes.filesystem.deniedAbove(pardes.filesystem.expandHome(text, &home_buf))) return false;
+ }
+ if (!state.dump_dir.set(text)) return false;
+ },
.message_ms => |which| {
const text = std.mem.trim(u8, argument orelse return false, " \t\r\n");
for (text) |byte| if (!std.ascii.isDigit(byte)) return false;
@@ -1267,7 +1277,7 @@ pub const Runtime = struct {
.tagline_size => std.fmt.comptimePrint("{d}-{d} (a percentage)", .{ tagline_percent_min, tagline_percent_max }),
.message_ms => std.fmt.comptimePrint("0-{d} (milliseconds)", .{message_ms_max}),
.shell => "a path of at most 255 bytes; bare, $SHELL, else /bin/sh",
- .dump_dir => std.fmt.comptimePrint("a path of at most {d} bytes; bare, the default", .{limits.host_path_cap}),
+ .dump_dir => std.fmt.comptimePrint("an absolute or ~ path of at most {d} bytes, to a directory that may be written; bare, the default", .{limits.host_path_cap}),
.shader => "a Shadertoy file's path, or off",
.font => "a name or path, :8 to :72 after it (Mono:14)",
else => null,