aboutsummaryrefslogtreecommitdiff
path: root/std/build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-09-18 18:01:58 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-09-18 18:01:58 -0400
commit10ad3253de4dad4675fbd84da874f2cd73cd2deb (patch)
treeece2ba5e1aa0ac4e48db715d41a78076ae35f06d /std/build.zig
parent24b6dcc507c6598351ab817e03027cc60f220f19 (diff)
downloadzig-10ad3253de4dad4675fbd84da874f2cd73cd2deb.tar.gz
zig-10ad3253de4dad4675fbd84da874f2cd73cd2deb.zip
std.build: catch mistake of setting output path to build dir
closes #464
Diffstat (limited to 'std/build.zig')
-rw-r--r--std/build.zig18
1 files changed, 14 insertions, 4 deletions
diff --git a/std/build.zig b/std/build.zig
index a241064a84..f2221d25f0 100644
--- a/std/build.zig
+++ b/std/build.zig
@@ -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 {