Returns the non-absolute path from from to to.
Other than memory allocation, this is a pure function; the result solely depends on the input parameters.
If from and to each resolve to the same path (after calling resolve
on each), a zero-length string is returned.
See relativePosix and relativeWindows for operating system specific
details and for how environ_map is used.
pub fn relative(
gpa: Allocator,
cwd: []const u8,
environ_map: ?*const std.process.Environ.Map,
from: []const u8,
to: []const u8,
) Allocator.Error![]u8
pub fn relative(
gpa: Allocator,
cwd: []const u8,
environ_map: ?*const std.process.Environ.Map,
from: []const u8,
to: []const u8,
) Allocator.Error![]u8 {
if (native_os == .windows) {
return relativeWindows(gpa, cwd, environ_map, from, to);
} else {
return relativePosix(gpa, cwd, from, to);
}
}