std.build: catch mistake of setting output path to build dir

closes #464
This commit is contained in:
Andrew Kelley 2017-09-18 18:01:58 -04:00
parent 24b6dcc507
commit 10ad3253de

View File

@ -937,8 +937,13 @@ pub const LibExeObjStep = struct {
self.build_mode = mode;
}
pub fn setOutputPath(self: &LibExeObjStep, value: []const u8) {
self.output_path = value;
pub fn setOutputPath(self: &LibExeObjStep, file_path: []const u8) {
self.output_path = file_path;
// catch a common mistake
if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) {
debug.panic("setOutputPath wants a file path, not a directory\n");
}
}
pub fn getOutputPath(self: &LibExeObjStep) -> []const u8 {
@ -949,8 +954,13 @@ pub const LibExeObjStep = struct {
}
}
pub fn setOutputHPath(self: &LibExeObjStep, value: []const u8) {
self.output_h_path = value;
pub fn setOutputHPath(self: &LibExeObjStep, file_path: []const u8) {
self.output_h_path = file_path;
// catch a common mistake
if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) {
debug.panic("setOutputHPath wants a file path, not a directory\n");
}
}
pub fn getOutputHPath(self: &LibExeObjStep) -> []const u8 {