One random point of clarification since I’ve seen it trip people up:
The APIs in std.fs.Dir
can handle both relative and absolute paths
/
works on every platform if you’re using the std.fs
APIs (the lower level Windows-specific APIs may need \
, but the higher level cross-platform APIs will take care of transforming them for you under-the-hood).
By leaning into using std.fs.Dir
, you get:
- better protection against Time Of Check, Time Of Use bugs
- your code will likely just work when targeting WASI without any extra effort
See the “Why Dir-based for everything” section of this (closed) proposal