| ... | @@ -805,7 +805,7 @@ pub const Builder = struct { | ... | @@ -805,7 +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 | if (fs.realpathAlloc(self.allocator, full_path)) |real_path| { |
| 809 | return real_path; | 809 | return real_path; |
| 810 | } else |_| { | 810 | } else |_| { |
| 811 | continue; | 811 | continue; |
| ... | @@ -817,10 +817,10 @@ pub const Builder = struct { | ... | @@ -817,10 +817,10 @@ pub const Builder = struct { |
| 817 | if (fs.path.isAbsolute(name)) { | 817 | if (fs.path.isAbsolute(name)) { |
| 818 | return name; | 818 | return name; |
| 819 | } | 819 | } |
| 820 | var it = mem.tokenize(PATH, []u8{fs.path.delimiter}); | 820 | var it = mem.tokenize(PATH, [_]u8{fs.path.delimiter}); |
| 821 | while (it.next()) |path| { | 821 | while (it.next()) |path| { |
| 822 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) }); | 822 | 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| { | 823 | if (fs.realpathAlloc(self.allocator, full_path)) |real_path| { |
| 824 | return real_path; | 824 | return real_path; |
| 825 | } else |_| { | 825 | } else |_| { |
| 826 | continue; | 826 | continue; |
| ... | @@ -834,7 +834,7 @@ pub const Builder = struct { | ... | @@ -834,7 +834,7 @@ pub const Builder = struct { |
| 834 | } | 834 | } |
| 835 | for (paths) |path| { | 835 | for (paths) |path| { |
| 836 | const full_path = try fs.path.join(self.allocator, [_][]const u8{ path, self.fmt("{}{}", name, exe_extension) }); | 836 | 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| { | 837 | if (fs.realpathAlloc(self.allocator, full_path)) |real_path| { |
| 838 | return real_path; | 838 | return real_path; |
| 839 | } else |_| { | 839 | } else |_| { |
| 840 | continue; | 840 | continue; |
| ... | @@ -904,6 +904,15 @@ pub const Builder = struct { | ... | @@ -904,6 +904,15 @@ pub const Builder = struct { |
| 904 | } | 904 | } |
| 905 | }; | 905 | }; |
| 906 | | 906 | |
| | 907 | test "builder.findProgram compiles" { |
| | 908 | //allocator: *Allocator, |
| | 909 | //zig_exe: []const u8, |
| | 910 | //build_root: []const u8, |
| | 911 | //cache_root: []const u8, |
| | 912 | const builder = try Builder.create(std.heap.direct_allocator, "zig", "zig-cache", "zig-cache"); |
| | 913 | _ = builder.findProgram([_][]const u8{}, [_][]const u8{}) catch null; |
| | 914 | } |
| | 915 | |
| 907 | pub const Version = struct { | 916 | pub const Version = struct { |
| 908 | major: u32, | 917 | major: u32, |
| 909 | minor: u32, | 918 | minor: u32, |