diff --git a/lib/std/Build.zig b/lib/std/Build.zig index 29499d8767..317e4600a4 100644 --- a/lib/std/Build.zig +++ b/lib/std/Build.zig @@ -1762,7 +1762,10 @@ fn supportedWindowsProgramExtension(ext: []const u8) bool { } fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { - if (fs.realpathAlloc(b.allocator, full_path)) |p| { + const io = b.graph.io; + const arena = b.allocator; + + if (Io.Dir.realPathFileAbsoluteAlloc(io, full_path, arena)) |p| { return p; } else |err| switch (err) { error.OutOfMemory => @panic("OOM"), @@ -1776,7 +1779,11 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { while (it.next()) |ext| { if (!supportedWindowsProgramExtension(ext)) continue; - return fs.realPathFileAlloc(b.graph.io, b.fmt("{s}{s}", .{ full_path, ext }), b.allocator) catch |err| switch (err) { + return Io.Dir.realPathFileAbsoluteAlloc( + io, + b.fmt("{s}{s}", .{ full_path, ext }), + arena, + ) catch |err| switch (err) { error.OutOfMemory => @panic("OOM"), else => continue, }; diff --git a/test/standalone/windows_bat_args/test.zig b/test/standalone/windows_bat_args/test.zig index 04d2fa37f0..4630fa3337 100644 --- a/test/standalone/windows_bat_args/test.zig +++ b/test/standalone/windows_bat_args/test.zig @@ -101,7 +101,7 @@ pub fn main() anyerror!void { // operable program or batch file. try std.testing.expectError(error.FileNotFound, testExecBat(gpa, "args1.bat .. ", &.{"abc"}, null)); const absolute_with_trailing = blk: { - const absolute_path = try std.fs.realpathAlloc(gpa, "args1.bat"); + const absolute_path = try Io.Dir.realPathFileAbsoluteAlloc(io, "args1.bat", gpa); defer gpa.free(absolute_path); break :blk try std.mem.concat(gpa, u8, &.{ absolute_path, " .. " }); }; diff --git a/test/standalone/windows_spawn/main.zig b/test/standalone/windows_spawn/main.zig index d89dc18bc2..569eba0407 100644 --- a/test/standalone/windows_spawn/main.zig +++ b/test/standalone/windows_spawn/main.zig @@ -22,11 +22,11 @@ pub fn main() anyerror!void { var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const tmp_absolute_path = try tmp.dir.realpathAlloc(gpa, "."); + const tmp_absolute_path = try tmp.dir.realPathFileAlloc(io, ".", gpa); defer gpa.free(tmp_absolute_path); const tmp_absolute_path_w = try std.unicode.utf8ToUtf16LeAllocZ(gpa, tmp_absolute_path); defer gpa.free(tmp_absolute_path_w); - const cwd_absolute_path = try Io.Dir.cwd().realpathAlloc(gpa, "."); + const cwd_absolute_path = try Io.Dir.cwd().realPathFileAlloc(io, ".", gpa); defer gpa.free(cwd_absolute_path); const tmp_relative_path = try std.fs.path.relative(gpa, cwd_absolute_path, tmp_absolute_path); defer gpa.free(tmp_relative_path); diff --git a/tools/fetch_them_macos_headers.zig b/tools/fetch_them_macos_headers.zig index 6b25495472..6575aa2b56 100644 --- a/tools/fetch_them_macos_headers.zig +++ b/tools/fetch_them_macos_headers.zig @@ -134,7 +134,7 @@ fn fetchTarget( ) !void { const tmp_filename = "macos-headers"; const headers_list_filename = "macos-headers.o.d"; - const tmp_path = try tmp.dir.realpathAlloc(arena, "."); + const tmp_path = try tmp.dir.realPathFileAlloc(io, ".", arena); const tmp_file_path = try Dir.path.join(arena, &[_][]const u8{ tmp_path, tmp_filename }); const headers_list_path = try Dir.path.join(arena, &[_][]const u8{ tmp_path, headers_list_filename });