| ... | ... | @@ -805,11 +805,7 @@ pub const Builder = struct { |
| 805 | 805 | return name; |
| 806 | 806 | } |
| 807 | 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| { |
| 809 | | return real_path; |
| 810 | | } else |_| { |
| 811 | | continue; |
| 812 | | } |
| 808 | return fs.realpathAlloc(self.allocator, full_path) catch continue; |
| 813 | 809 | } |
| 814 | 810 | } |
| 815 | 811 | if (self.env_map.get("PATH")) |PATH| { |
| ... | ... | @@ -817,14 +813,10 @@ pub const Builder = struct { |
| 817 | 813 | if (fs.path.isAbsolute(name)) { |
| 818 | 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 | 817 | while (it.next()) |path| { |
| 822 | 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| { |
| 824 | | return real_path; |
| 825 | | } else |_| { |
| 826 | | continue; |
| 827 | | } |
| 819 | return fs.realpathAlloc(self.allocator, full_path) catch continue; |
| 828 | 820 | } |
| 829 | 821 | } |
| 830 | 822 | } |
| ... | ... | @@ -834,11 +826,7 @@ pub const Builder = struct { |
| 834 | 826 | } |
| 835 | 827 | for (paths) |path| { |
| 836 | 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| { |
| 838 | | return real_path; |
| 839 | | } else |_| { |
| 840 | | continue; |
| 841 | | } |
| 829 | return fs.realpathAlloc(self.allocator, full_path) catch continue; |
| 842 | 830 | } |
| 843 | 831 | } |
| 844 | 832 | return error.FileNotFound; |
| ... | ... | @@ -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 | 904 | pub const Version = struct { |
| 908 | 905 | major: u32, |
| 909 | 906 | minor: u32, |
| ... | ... | @@ -1122,6 +1119,9 @@ pub const Target = union(enum) { |
| 1122 | 1119 | } |
| 1123 | 1120 | |
| 1124 | 1121 | pub fn libPrefix(self: Target) []const u8 { |
| 1122 | if (self.isWasm()) { |
| 1123 | return ""; |
| 1124 | } |
| 1125 | 1125 | switch (self.getAbi()) { |
| 1126 | 1126 | .msvc => return "", |
| 1127 | 1127 | else => return "lib", |