feature. See also
. The project being documented here (as the example) is the Zig library itself.
Maker.relativePath
pub fn relativePath(maker: *const Maker, arena: Allocator, relative: Configuration.LazyPath.Relative) Allocator.Error!Path
File
Code
pub fn relativePath(maker: *const Maker, arena: Allocator, relative: Configuration.LazyPath.Relative) Allocator.Error!Path {
const graph = maker.graph;
const c = &maker.scanned_config.configuration;
const sub_path = relative.sub_path.slice(c);
return switch (relative.flags.base) {
.cwd => .{
.root_dir = .cwd(),
.sub_path = sub_path,
},
.local_cache => .{
.root_dir = graph.local_cache_root,
.sub_path = sub_path,
},
.global_cache => .{
.root_dir = graph.global_cache_root,
.sub_path = sub_path,
},
.build_root => .{
.root_dir = graph.build_root_directory,
.sub_path = sub_path,
},
.zig_exe => .{
.root_dir = .cwd(),
.sub_path = if (sub_path.len == 0)
graph.zig_exe
else
try Io.Dir.path.join(arena, &.{ graph.zig_exe, sub_path }),
},
.zig_lib => .{
.root_dir = graph.zig_lib_directory,
.sub_path = sub_path,
},
.install_prefix => try maker.install_paths.prefix.join(arena, sub_path),
.install_lib => try maker.install_paths.lib.join(arena, sub_path),
.install_bin => try maker.install_paths.bin.join(arena, sub_path),
.install_include => try maker.install_paths.include.join(arena, sub_path),
};
}