| ... | @@ -805,11 +805,7 @@ pub const Builder = struct { | ... | @@ -805,11 +805,7 @@ pub const Builder = struct { |
| 805 | return name; | 805 | return name; |
| 806 | } | 806 | } |
| 807 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ search_prefix, "bin", self.fmt("{}{}", name, exe_extension) }); | 807 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ search_prefix, "bin", self.fmt("{}{}", name, exe_extension) }); |
| 808 | if (fs.path.real(self.allocator, full_path)) |real_path| { | 808 | return fs.realpathAlloc(self.allocator, full_path) catch continue; |
| 809 | return real_path; | | |
| 810 | } else |_| { | | |
| 811 | continue; | | |
| 812 | } | | |
| 813 | } | 809 | } |
| 814 | } | 810 | } |
| 815 | if (self.env_map.get("PATH")) |PATH| { | 811 | if (self.env_map.get("PATH")) |PATH| { |
| ... | @@ -817,14 +813,10 @@ pub const Builder = struct { | ... | @@ -817,14 +813,10 @@ pub const Builder = struct { |
| 817 | if (fs.path.isAbsolute(name)) { | 813 | if (fs.path.isAbsolute(name)) { |
| 818 | return name; | 814 | return name; |
| 819 | } | 815 | } |
| 820 | var it = mem.tokenize(PATH, []u8{fs.path.delimiter}); | 816 | var it = mem.tokenize(PATH, [_]u8{fs.path.delimiter}); |
| 821 | while (it.next()) |path| { | 817 | while (it.next()) |path| { |
| 822 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) }); | 818 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) }); |
| 823 | if (fs.path.real(self.allocator, full_path)) |real_path| { | 819 | return fs.realpathAlloc(self.allocator, full_path) catch continue; |
| 824 | return real_path; | | |
| 825 | } else |_| { | | |
| 826 | continue; | | |
| 827 | } | | |
| 828 | } | 820 | } |
| 829 | } | 821 | } |
| 830 | } | 822 | } |
| ... | @@ -834,11 +826,7 @@ pub const Builder = struct { | ... | @@ -834,11 +826,7 @@ pub const Builder = struct { |
| 834 | } | 826 | } |
| 835 | for (paths) |path| { | 827 | for (paths) |path| { |
| 836 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) }); | 828 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) }); |
| 837 | if (fs.path.real(self.allocator, full_path)) |real_path| { | 829 | return fs.realpathAlloc(self.allocator, full_path) catch continue; |
| 838 | return real_path; | | |
| 839 | } else |_| { | | |
| 840 | continue; | | |
| 841 | } | | |
| 842 | } | 830 | } |
| 843 | } | 831 | } |
| 844 | return error.FileNotFound; | 832 | return error.FileNotFound; |
| ... | @@ -904,6 +892,15 @@ pub const Builder = struct { | ... | @@ -904,6 +892,15 @@ pub const Builder = struct { |
| 904 | } | 892 | } |
| 905 | }; | 893 | }; |
| 906 | | 894 | |
| | 895 | test "builder.findProgram compiles" { |
| | 896 | //allocator: *Allocator, |
| | 897 | //zig_exe: []const u8, |
| | 898 | //build_root: []const u8, |
| | 899 | //cache_root: []const u8, |
| | 900 | const builder = try Builder.create(std.heap.direct_allocator, "zig", "zig-cache", "zig-cache"); |
| | 901 | _ = builder.findProgram([_][]const u8{}, [_][]const u8{}) catch null; |
| | 902 | } |
| | 903 | |
| 907 | pub const Version = struct { | 904 | pub const Version = struct { |
| 908 | major: u32, | 905 | major: u32, |
| 909 | minor: u32, | 906 | minor: u32, |
| ... | @@ -1122,6 +1119,9 @@ pub const Target = union(enum) { | ... | @@ -1122,6 +1119,9 @@ pub const Target = union(enum) { |
| 1122 | } | 1119 | } |
| 1123 | | 1120 | |
| 1124 | pub fn libPrefix(self: Target) []const u8 { | 1121 | pub fn libPrefix(self: Target) []const u8 { |
| | 1122 | if (self.isWasm()) { |
| | 1123 | return ""; |
| | 1124 | } |
| 1125 | switch (self.getAbi()) { | 1125 | switch (self.getAbi()) { |
| 1126 | .msvc => return "", | 1126 | .msvc => return "", |
| 1127 | else => return "lib", | 1127 | else => return "lib", |