Function realpath [src]
Prototype
pub fn realpath(self: Dir, pathname: []const u8, out_buffer: []u8) RealPathError![]u8
Parameters
self: Dir
pathname: []const u8
out_buffer: []u8
Possible Errors
On Windows, antivirus software is enabled by default. It can be disabled, but Windows Update sometimes ignores the user's preference and re-enables it. When enabled, antivirus software on Windows intercepts file system operations and makes them significantly slower in addition to possibly failing with this error code.
Windows-only; file paths provided by the user must be valid WTF-8. https://simonsapin.github.io/wtf-8/
On Windows, \\server
or \\server\share
was not found.
The Operating System returned an undocumented error code.
This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.
When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.
On Windows, the volume does not contain a recognized file system. File system drivers might not be loaded, or the volume may be corrupt.
Source
pub fn realpath(self: Dir, pathname: []const u8, out_buffer: []u8) RealPathError![]u8 {
if (native_os == .wasi) {
@compileError("realpath is not available on WASI");
}
if (native_os == .windows) {
const pathname_w = try windows.sliceToPrefixedFileW(self.fd, pathname);
return self.realpathW(pathname_w.span(), out_buffer);
}
const pathname_c = try posix.toPosixPath(pathname);
return self.realpathZ(&pathname_c, out_buffer);
}