This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Constant
The maximum length of a file path that the operating system will accept.
Paths, including those returned from file system operations, may be longer than this length, but such paths cannot be successfully passed back in other file system operations. However, all path components returned by file system operations are assumed to fit into a u8 array of this length.
The byte count includes room for a null sentinel byte.
On WASI, []u8 file paths are encoded as valid UTF-8.
On other platforms, []u8 file paths are opaque sequences of bytes with no particular encoding.
File
Io/Dir.zig:33
333435363738394041424344
pubconstmax_path_bytes = switch (native_os) {
.linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .illumos, .plan9, .emscripten, .wasi, .serenity => std.posix.PATH_MAX,
// Each WTF-16LE code unit may be expanded to 3 WTF-8 bytes.// If it would require 4 WTF-8 bytes, then there would be a surrogate// pair in the WTF-16LE, and we (over)account 3 bytes for it that way.// +1 for the null byte at the end, which can be encoded in 1 byte.
.windows => std.os.windows.PATH_MAX_WIDE * 3 + 1,
else => if (@hasDecl(root, "os") and@hasDecl(root.os, "PATH_MAX"))
root.os.PATH_MAXelse@compileError("PATH_MAX not implemented for " ++ @tagName(native_os)),
}
The maximum length of a file path that the operating system will accept.
Paths, including those returned from file system operations, may be longer than this length, but such paths cannot be successfully passed back in other file system operations. However, all path components returned by file system operations are assumed to fit into a
u8array of this length.The byte count includes room for a null sentinel byte.
[]u8file paths are encoded as WTF-8.[]u8file paths are encoded as valid UTF-8.[]u8file paths are opaque sequences of bytes with no particular encoding.