aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fs.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/fs.zig')
-rw-r--r--lib/std/fs.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 390efec50c..c69a6ca5cd 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -3,6 +3,7 @@
// This file is part of [zig](https://ziglang.org/), which is MIT licensed.
// The MIT license requires this copyright notice to be included in all copies
// and substantial portions of the software.
+const root = @import("root");
const builtin = std.builtin;
const std = @import("std.zig");
const os = std.os;
@@ -47,7 +48,10 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
.windows => os.windows.PATH_MAX_WIDE * 3 + 1,
// TODO work out what a reasonable value we should use here
.wasi => 4096,
- else => @compileError("Unsupported OS"),
+ else => if (@hasDecl(root, "os") and @hasDecl(root.os, "PATH_MAX"))
+ root.os.PATH_MAX
+ else
+ @compileError("PATH_MAX not implemented for " ++ @tagName(builtin.os.tag)),
};
pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*;