std/build: assert that install paths are relative

If absolute paths are passed they will work unless $DESTDIR is set,
which causes subtly broken build.zig's.
This commit is contained in:
Isaac Freund 2021-01-01 22:56:43 +01:00 committed by Andrew Kelley
parent 3dafc5b9a3
commit d3ecbbebd3

View File

@ -1100,6 +1100,7 @@ pub const Builder = struct {
}
pub fn getInstallPath(self: *Builder, dir: InstallDir, dest_rel_path: []const u8) []const u8 {
assert(!fs.path.isAbsolute(dest_rel_path)); // Install paths must be relative to the prefix
const base_dir = switch (dir) {
.Prefix => self.install_path,
.Bin => self.exe_dir,