diff options
Diffstat (limited to 'lib/std/fs.zig')
| -rw-r--r-- | lib/std/fs.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 3f0bd9d645..cc1b73acf2 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -2661,17 +2661,17 @@ pub fn cwd() Dir { if (builtin.os.tag == .windows) { return Dir{ .fd = os.windows.peb().ProcessParameters.CurrentDirectory.Handle }; } else if (builtin.os.tag == .wasi) { - if (@hasDecl(root, "wasi_cwd")) { - return root.wasi_cwd(); - } else { - // Expect the first preopen to be current working directory. - return .{ .fd = 3 }; - } + return std.options.wasiCwd(); } else { return Dir{ .fd = os.AT.FDCWD }; } } +pub fn defaultWasiCwd() Dir { + // Expect the first preopen to be current working directory. + return .{ .fd = 3 }; +} + /// Opens a directory at the given path. The directory is a system resource that remains /// open until `close` is called on the result. /// See `openDirAbsoluteZ` for a function that accepts a null-terminated path. |
