pub fn relative( gpa: Allocator, cwd: []const u8, environ_map: ?*const std.process.Environ.Map, from: []const u8, to: []const u8, ) Allocator.Error![]u8
Returns the non-absolute path from from to to.
from
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.
resolve
See relativePosix and relativeWindows for operating system specific details and for how environ_map is used.
relativePosix
relativeWindows
environ_map
gpa: Allocator
cwd: []const u8
environ_map: ?*const std.process.Environ.Map
from: []const u8
to: []const u8
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523
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); } }
Returns the non-absolute path from
fromtoto.Other than memory allocation, this is a pure function; the result solely depends on the input parameters.
If
fromandtoeach resolve to the same path (after callingresolveon each), a zero-length string is returned.See
relativePosixandrelativeWindowsfor operating system specific details and for howenviron_mapis used.