| ... | @@ -1836,10 +1836,14 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { | ... | @@ -1836,10 +1836,14 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { |
| 1836 | if (b.graph.environ_map.get("PATHEXT")) |PATHEXT| { | 1836 | if (b.graph.environ_map.get("PATHEXT")) |PATHEXT| { |
| 1837 | var it = mem.tokenizeScalar(u8, PATHEXT, fs.path.delimiter); | 1837 | var it = mem.tokenizeScalar(u8, PATHEXT, fs.path.delimiter); |
| 1838 | | 1838 | |
| | 1839 | const extended_path_buf = arena.alloc(u8, full_path.len + 1 + std.process.WindowsExtension.max_len) catch @panic("OOM"); |
| | 1840 | @memcpy(extended_path_buf[0..full_path.len], full_path); |
| | 1841 | |
| 1839 | while (it.next()) |ext| { | 1842 | while (it.next()) |ext| { |
| 1840 | if (!supportedWindowsProgramExtension(ext)) continue; | 1843 | if (!supportedWindowsProgramExtension(ext)) continue; |
| 1841 | | 1844 | |
| 1842 | const extended_path = try mem.concat(arena, u8, &.{ full_path, ext }); | 1845 | @memcpy(extended_path_buf[full_path.len..][0..ext.len], ext); |
| | 1846 | const extended_path = extended_path_buf[0 .. full_path.len + ext.len]; |
| 1843 | | 1847 | |
| 1844 | if (Io.Dir.cwd().access(io, extended_path, .{ .execute = true })) |_| { | 1848 | if (Io.Dir.cwd().access(io, extended_path, .{ .execute = true })) |_| { |
| 1845 | return extended_path; | 1849 | return extended_path; |
| ... | @@ -2708,4 +2712,5 @@ test { | ... | @@ -2708,4 +2712,5 @@ test { |
| 2708 | _ = Cache; | 2712 | _ = Cache; |
| 2709 | _ = Step; | 2713 | _ = Step; |
| 2710 | _ = Configuration; | 2714 | _ = Configuration; |
| | 2715 | _ = &findProgram; |
| 2711 | } | 2716 | } |