mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:44:43 +01:00
Fix: tryFindProgram fails when $PATH contains relative paths (#30619)
Fixes a issue in tryFindProgram where it would fail if the PATH environment variable contained relative paths, due to its incorrect assumption that the full_path argument is always absolute path. Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30619 Co-authored-by: hixuyuming <hixuyuming@gmail.com> Co-committed-by: hixuyuming <hixuyuming@gmail.com>
This commit is contained in:
parent
2bd02883c7
commit
0c5f879b98
1 changed files with 2 additions and 2 deletions
|
|
@ -1765,7 +1765,7 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 {
|
|||
const io = b.graph.io;
|
||||
const arena = b.allocator;
|
||||
|
||||
if (Io.Dir.realPathFileAbsoluteAlloc(io, full_path, arena)) |p| {
|
||||
if (b.build_root.handle.realPathFileAlloc(io, full_path, arena)) |p| {
|
||||
return p;
|
||||
} else |err| switch (err) {
|
||||
error.OutOfMemory => @panic("OOM"),
|
||||
|
|
@ -1779,7 +1779,7 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 {
|
|||
while (it.next()) |ext| {
|
||||
if (!supportedWindowsProgramExtension(ext)) continue;
|
||||
|
||||
return Io.Dir.realPathFileAbsoluteAlloc(
|
||||
return b.build_root.handle.realPathFileAlloc(
|
||||
io,
|
||||
b.fmt("{s}{s}", .{ full_path, ext }),
|
||||
arena,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue