I’m developing a library that manages files and I want the client to ba able to select where the working directory is so it can change the relative paths for opening files. The C++ equivalent is std::filesystem::current_path(working_dir_str); but I can’t find any Zig equivalent.
There’s also std.fs.Dir.setAsCwd
if you have a Dir
:
var dir = try std.fs.cwd().openDir("some-path/to/dir", .{});
defer dir.close();
try dir.setAsCwd();
4 Likes