summaryrefslogtreecommitdiff
path: root/src/fs.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:14:58 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commit4c194047d210ad9cf571c6019731d00d1e3615a4 (patch)
tree257b994e471db3011589acd0cfb4a9168f803019 /src/fs.zig
parent60dd9514c8676e79c625948b5e9d2c6d745e8e87 (diff)
downloadpardes-4c194047d210ad9cf571c6019731d00d1e3615a4.tar.gz
pardes-4c194047d210ad9cf571c6019731d00d1e3615a4.zip
idioms #4, string chains are an enum and a switch: main's flags (each exact one a Flag, the prefixed ones as they were), --ps's rows and manage's verb, the daemon's verbs on both ends and its registry's rows, an upgrade record's words, the window driver's mouse kinds and finger names, a frame script's click target and a mount name's reserved words go through std.meta.stringToEnum; with them main asks std.Io for its working directory, its chdir, a directory's access and /proc's comm, not libc
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/fs.zig')
-rw-r--r--src/fs.zig3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/fs.zig b/src/fs.zig
index e3976884..97f67061 100644
--- a/src/fs.zig
+++ b/src/fs.zig
@@ -281,8 +281,7 @@ fn osReadWrite(path_z: [:0]const u8, req: Req, attr: Reply.Attr, buf: []u8) OsRe
}
pub fn validMountName(name: []const u8) bool {
- if (name.len == 0 or name.len > name_capacity or std.mem.eql(u8, name, ".") or std.mem.eql(u8, name, "..")) return false;
- if (std.mem.eql(u8, name, "os") or std.mem.eql(u8, name, "self")) return false;
+ if (name.len == 0 or name.len > name_capacity or std.meta.stringToEnum(enum { @".", @"..", os, self }, name) != null) return false;
for (name) |c| if (!std.ascii.isAlphanumeric(c) and c != '_' and c != '-' and c != '.') return false;
return true;
}