authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-09-18 18:01:58-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-09-18 18:01:58-04:00
log10ad3253de4dad4675fbd84da874f2cd73cd2deb
treeece2ba5e1aa0ac4e48db715d41a78076ae35f06d
parent24b6dcc507c6598351ab817e03027cc60f220f19

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

closes #464

1 files changed, 14 insertions(+), 4 deletions(-)

std/build.zig+14-4
...@@ -937,8 +937,13 @@ pub const LibExeObjStep = struct {...@@ -937,8 +937,13 @@ pub const LibExeObjStep = struct {
937 self.build_mode = mode;937 self.build_mode = mode;
938 }938 }
939939
940 pub fn setOutputPath(self: &LibExeObjStep, value: []const u8) {940 pub fn setOutputPath(self: &LibExeObjStep, file_path: []const u8) {
941 self.output_path = value;941 self.output_path = file_path;
942
943 // catch a common mistake
944 if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) {
945 debug.panic("setOutputPath wants a file path, not a directory\n");
946 }
942 }947 }
943948
944 pub fn getOutputPath(self: &LibExeObjStep) -> []const u8 {949 pub fn getOutputPath(self: &LibExeObjStep) -> []const u8 {
...@@ -949,8 +954,13 @@ pub const LibExeObjStep = struct {...@@ -949,8 +954,13 @@ pub const LibExeObjStep = struct {
949 }954 }
950 }955 }
951956
952 pub fn setOutputHPath(self: &LibExeObjStep, value: []const u8) {957 pub fn setOutputHPath(self: &LibExeObjStep, file_path: []const u8) {
953 self.output_h_path = value;958 self.output_h_path = file_path;
959
960 // catch a common mistake
961 if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) {
962 debug.panic("setOutputHPath wants a file path, not a directory\n");
963 }
954 }964 }
955965
956 pub fn getOutputHPath(self: &LibExeObjStep) -> []const u8 {966 pub fn getOutputHPath(self: &LibExeObjStep) -> []const u8 {