Like std.process.currentPathAlloc, but also resolves the path with Dir.path.resolve. This
means the path has no repeated separators, no "." or ".." components, and no trailing separator.
On WASI, "" is returned instead of ".".
pub fn getResolvedCwd(io: Io, gpa: Allocator) std.process.CurrentPathAllocError![]u8
pub fn getResolvedCwd(io: Io, gpa: Allocator) std.process.CurrentPathAllocError![]u8 {
if (builtin.os.tag == .wasi) {
if (std.debug.runtime_safety) {
const cwd = try std.process.currentPathAlloc(io, gpa);
defer gpa.free(cwd);
assert(mem.eql(u8, cwd, "."));
}
return "";
}
const cwd = try std.process.currentPathAlloc(io, gpa);
defer gpa.free(cwd);
const resolved = try Dir.path.resolve(gpa, &.{cwd});
assert(Dir.path.isAbsolute(resolved));
return resolved;
}