| author | |
| committer | |
| log | 70e19ea3533528b90b4548e162e334f5a8392e64 |
| tree | 88b0cad9fedc6d5af367ace24aaa41c502640d65 |
| parent | 51a6f3a5251096f346eb28b22e1c20ed2ceb7d9e |
4 files changed, 13 insertions(+), 6 deletions(-)
lib/std/Build.zig+9-2| ... | @@ -1762,7 +1762,10 @@ fn supportedWindowsProgramExtension(ext: []const u8) bool { | ... | @@ -1762,7 +1762,10 @@ fn supportedWindowsProgramExtension(ext: []const u8) bool { |
| 1762 | } | 1762 | } |
| 1763 | 1763 | ||
| 1764 | fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { | 1764 | fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { |
| 1765 | if (fs.realpathAlloc(b.allocator, full_path)) |p| { | 1765 | const io = b.graph.io; |
| 1766 | const arena = b.allocator; | ||
| 1767 | |||
| 1768 | if (Io.Dir.realPathFileAbsoluteAlloc(io, full_path, arena)) |p| { | ||
| 1766 | return p; | 1769 | return p; |
| 1767 | } else |err| switch (err) { | 1770 | } else |err| switch (err) { |
| 1768 | error.OutOfMemory => @panic("OOM"), | 1771 | error.OutOfMemory => @panic("OOM"), |
| ... | @@ -1776,7 +1779,11 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { | ... | @@ -1776,7 +1779,11 @@ fn tryFindProgram(b: *Build, full_path: []const u8) ?[]const u8 { |
| 1776 | while (it.next()) |ext| { | 1779 | while (it.next()) |ext| { |
| 1777 | if (!supportedWindowsProgramExtension(ext)) continue; | 1780 | if (!supportedWindowsProgramExtension(ext)) continue; |
| 1778 | 1781 | ||
| 1779 | return fs.realPathFileAlloc(b.graph.io, b.fmt("{s}{s}", .{ full_path, ext }), b.allocator) catch |err| switch (err) { | 1782 | return Io.Dir.realPathFileAbsoluteAlloc( |
| 1783 | io, | ||
| 1784 | b.fmt("{s}{s}", .{ full_path, ext }), | ||
| 1785 | arena, | ||
| 1786 | ) catch |err| switch (err) { | ||
| 1780 | error.OutOfMemory => @panic("OOM"), | 1787 | error.OutOfMemory => @panic("OOM"), |
| 1781 | else => continue, | 1788 | else => continue, |
| 1782 | }; | 1789 | }; |
test/standalone/windows_bat_args/test.zig+1-1| ... | @@ -101,7 +101,7 @@ pub fn main() anyerror!void { | ... | @@ -101,7 +101,7 @@ pub fn main() anyerror!void { |
| 101 | // operable program or batch file. | 101 | // operable program or batch file. |
| 102 | try std.testing.expectError(error.FileNotFound, testExecBat(gpa, "args1.bat .. ", &.{"abc"}, null)); | 102 | try std.testing.expectError(error.FileNotFound, testExecBat(gpa, "args1.bat .. ", &.{"abc"}, null)); |
| 103 | const absolute_with_trailing = blk: { | 103 | const absolute_with_trailing = blk: { |
| 104 | const absolute_path = try std.fs.realpathAlloc(gpa, "args1.bat"); | 104 | const absolute_path = try Io.Dir.realPathFileAbsoluteAlloc(io, "args1.bat", gpa); |
| 105 | defer gpa.free(absolute_path); | 105 | defer gpa.free(absolute_path); |
| 106 | break :blk try std.mem.concat(gpa, u8, &.{ absolute_path, " .. " }); | 106 | break :blk try std.mem.concat(gpa, u8, &.{ absolute_path, " .. " }); |
| 107 | }; | 107 | }; |
test/standalone/windows_spawn/main.zig+2-2| ... | @@ -22,11 +22,11 @@ pub fn main() anyerror!void { | ... | @@ -22,11 +22,11 @@ pub fn main() anyerror!void { |
| 22 | var tmp = std.testing.tmpDir(.{}); | 22 | var tmp = std.testing.tmpDir(.{}); |
| 23 | defer tmp.cleanup(); | 23 | defer tmp.cleanup(); |
| 24 | 24 | ||
| 25 | const tmp_absolute_path = try tmp.dir.realpathAlloc(gpa, "."); | 25 | const tmp_absolute_path = try tmp.dir.realPathFileAlloc(io, ".", gpa); |
| 26 | defer gpa.free(tmp_absolute_path); | 26 | defer gpa.free(tmp_absolute_path); |
| 27 | const tmp_absolute_path_w = try std.unicode.utf8ToUtf16LeAllocZ(gpa, tmp_absolute_path); | 27 | const tmp_absolute_path_w = try std.unicode.utf8ToUtf16LeAllocZ(gpa, tmp_absolute_path); |
| 28 | defer gpa.free(tmp_absolute_path_w); | 28 | defer gpa.free(tmp_absolute_path_w); |
| 29 | const cwd_absolute_path = try Io.Dir.cwd().realpathAlloc(gpa, "."); | 29 | const cwd_absolute_path = try Io.Dir.cwd().realPathFileAlloc(io, ".", gpa); |
| 30 | defer gpa.free(cwd_absolute_path); | 30 | defer gpa.free(cwd_absolute_path); |
| 31 | const tmp_relative_path = try std.fs.path.relative(gpa, cwd_absolute_path, tmp_absolute_path); | 31 | const tmp_relative_path = try std.fs.path.relative(gpa, cwd_absolute_path, tmp_absolute_path); |
| 32 | defer gpa.free(tmp_relative_path); | 32 | defer gpa.free(tmp_relative_path); |
tools/fetch_them_macos_headers.zig+1-1| ... | @@ -134,7 +134,7 @@ fn fetchTarget( | ... | @@ -134,7 +134,7 @@ fn fetchTarget( |
| 134 | ) !void { | 134 | ) !void { |
| 135 | const tmp_filename = "macos-headers"; | 135 | const tmp_filename = "macos-headers"; |
| 136 | const headers_list_filename = "macos-headers.o.d"; | 136 | const headers_list_filename = "macos-headers.o.d"; |
| 137 | const tmp_path = try tmp.dir.realpathAlloc(arena, "."); | 137 | const tmp_path = try tmp.dir.realPathFileAlloc(io, ".", arena); |
| 138 | const tmp_file_path = try Dir.path.join(arena, &[_][]const u8{ tmp_path, tmp_filename }); | 138 | const tmp_file_path = try Dir.path.join(arena, &[_][]const u8{ tmp_path, tmp_filename }); |
| 139 | const headers_list_path = try Dir.path.join(arena, &[_][]const u8{ tmp_path, headers_list_filename }); | 139 | const headers_list_path = try Dir.path.join(arena, &[_][]const u8{ tmp_path, headers_list_filename }); |
| 140 | 140 |