| ... | @@ -898,10 +898,11 @@ pub const Object = struct { | ... | @@ -898,10 +898,11 @@ pub const Object = struct { |
| 898 | // very location dependent. | 898 | // very location dependent. |
| 899 | // TODO: the only concern I have with this is WASI as either host or target, should | 899 | // TODO: the only concern I have with this is WASI as either host or target, should |
| 900 | // we leave the paths as relative then? | 900 | // we leave the paths as relative then? |
| 901 | var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | | |
| 902 | const compile_unit_dir_z = blk: { | 901 | const compile_unit_dir_z = blk: { |
| 903 | if (options.module) |mod| { | 902 | var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; |
| | 903 | if (options.module) |mod| m: { |
| 904 | const d = try mod.root_mod.root.joinStringZ(builder.gpa, ""); | 904 | const d = try mod.root_mod.root.joinStringZ(builder.gpa, ""); |
| | 905 | if (d.len == 0) break :m; |
| 905 | if (std.fs.path.isAbsolute(d)) break :blk d; | 906 | if (std.fs.path.isAbsolute(d)) break :blk d; |
| 906 | const abs = std.fs.realpath(d, &buf) catch break :blk d; | 907 | const abs = std.fs.realpath(d, &buf) catch break :blk d; |
| 907 | builder.gpa.free(d); | 908 | builder.gpa.free(d); |
| ... | @@ -1840,7 +1841,8 @@ pub const Object = struct { | ... | @@ -1840,7 +1841,8 @@ pub const Object = struct { |
| 1840 | const dir_path = try file.mod.root.joinStringZ(gpa, sub_path); | 1841 | const dir_path = try file.mod.root.joinStringZ(gpa, sub_path); |
| 1841 | if (std.fs.path.isAbsolute(dir_path)) break :d dir_path; | 1842 | if (std.fs.path.isAbsolute(dir_path)) break :d dir_path; |
| 1842 | const abs = std.fs.realpath(dir_path, &buffer) catch break :d dir_path; | 1843 | const abs = std.fs.realpath(dir_path, &buffer) catch break :d dir_path; |
| 1843 | break :d try std.fs.path.joinZ(gpa, &.{ abs, sub_path }); | 1844 | gpa.free(dir_path); |
| | 1845 | break :d try gpa.dupeZ(u8, abs); |
| 1844 | }; | 1846 | }; |
| 1845 | defer gpa.free(dir_path_z); | 1847 | defer gpa.free(dir_path_z); |
| 1846 | const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path)); | 1848 | const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path)); |