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 {
937937 self.build_mode = mode;
938938 }
939939
940 pub fn setOutputPath(self: &LibExeObjStep, value: []const u8) {
941 self.output_path = value;
940 pub fn setOutputPath(self: &LibExeObjStep, file_path: []const u8) {
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 }
942947 }
943948
944949 pub fn getOutputPath(self: &LibExeObjStep) -> []const u8 {
......@@ -949,8 +954,13 @@ pub const LibExeObjStep = struct {
949954 }
950955 }
951956
952 pub fn setOutputHPath(self: &LibExeObjStep, value: []const u8) {
953 self.output_h_path = value;
957 pub fn setOutputHPath(self: &LibExeObjStep, file_path: []const u8) {
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 }
954964 }
955965
956966 pub fn getOutputHPath(self: &LibExeObjStep) -> []const u8 {