| author | |
| committer | |
| log | 6ab5bebed1d0808ad8153097332519088d5af95a |
| tree | c379dc481b9d8cce57e008f2931a20992b9da2d0 |
| parent | 52bc1442d6e48438a1f8fb155a4174e41d02090f |
Previously it used mem.split on "." and took the first iterated item.
Now it uses fs.path.extension and strips off that number of bytes.
Closes #74043 files changed, 7 insertions(+), 7 deletions(-)
src/Compilation.zig+2-2| ... | ... | @@ -1762,7 +1762,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_comp_progress_node: * |
| 1762 | 1762 | const o_basename_noext = if (direct_o) |
| 1763 | 1763 | comp.bin_file.options.root_name |
| 1764 | 1764 | else |
| 1765 | mem.split(c_source_basename, ".").next().?; | |
| 1765 | c_source_basename[0 .. c_source_basename.len - std.fs.path.extension(c_source_basename).len]; | |
| 1766 | 1766 | const o_basename = try std.fmt.allocPrint(arena, "{s}{s}", .{ o_basename_noext, comp.getTarget().oFileExt() }); |
| 1767 | 1767 | |
| 1768 | 1768 | const digest = if (!comp.disable_c_depfile and try man.hit()) man.final() else blk: { |
| ... | ... | @@ -2731,7 +2731,7 @@ fn buildOutputFromZig( |
| 2731 | 2731 | }, |
| 2732 | 2732 | .root_src_path = src_basename, |
| 2733 | 2733 | }; |
| 2734 | const root_name = mem.split(src_basename, ".").next().?; | |
| 2734 | const root_name = src_basename[0 .. src_basename.len - std.fs.path.extension(src_basename).len]; | |
| 2735 | 2735 | const target = comp.getTarget(); |
| 2736 | 2736 | const fixed_output_mode = if (target.cpu.arch.isWasm()) .Obj else output_mode; |
| 2737 | 2737 | const bin_basename = try std.zig.binNameAlloc(comp.gpa, .{ |
src/main.zig+4-4| ... | ... | @@ -1339,16 +1339,16 @@ fn buildOutputType( |
| 1339 | 1339 | break :blk "test"; |
| 1340 | 1340 | } else if (root_src_file) |file| { |
| 1341 | 1341 | const basename = fs.path.basename(file); |
| 1342 | break :blk mem.split(basename, ".").next().?; | |
| 1342 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1343 | 1343 | } else if (c_source_files.items.len >= 1) { |
| 1344 | 1344 | const basename = fs.path.basename(c_source_files.items[0].src_path); |
| 1345 | break :blk mem.split(basename, ".").next().?; | |
| 1345 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1346 | 1346 | } else if (link_objects.items.len >= 1) { |
| 1347 | 1347 | const basename = fs.path.basename(link_objects.items[0]); |
| 1348 | break :blk mem.split(basename, ".").next().?; | |
| 1348 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1349 | 1349 | } else if (emit_bin == .yes) { |
| 1350 | 1350 | const basename = fs.path.basename(emit_bin.yes); |
| 1351 | break :blk mem.split(basename, ".").next().?; | |
| 1351 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1352 | 1352 | } else if (show_builtin) { |
| 1353 | 1353 | break :blk "builtin"; |
| 1354 | 1354 | } else if (arg_mode == .run) { |
src/musl.zig+1-1| ... | ... | @@ -140,7 +140,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { |
| 140 | 140 | |
| 141 | 141 | const dirname = path.dirname(src_file).?; |
| 142 | 142 | const basename = path.basename(src_file); |
| 143 | const noextbasename = mem.split(basename, ".").next().?; | |
| 143 | const noextbasename = basename[0 .. basename.len - std.fs.path.extension(basename).len]; | |
| 144 | 144 | const before_arch_dir = path.dirname(dirname).?; |
| 145 | 145 | const dirbasename = path.basename(dirname); |
| 146 | 146 |