| author | |
| committer | |
| log | 1bbf731e7ef6ca738026ee82a8f50bf114efbf8c |
| tree | aa48963423cc8ec53e16026249545cba4da1d13e |
| parent | a6de0b413675717886a4d7fe1d00db10d802a191 |
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| ... | ... | @@ -1714,7 +1714,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_comp_progress_node: * |
| 1714 | 1714 | const o_basename_noext = if (direct_o) |
| 1715 | 1715 | comp.bin_file.options.root_name |
| 1716 | 1716 | else |
| 1717 | mem.split(c_source_basename, ".").next().?; | |
| 1717 | c_source_basename[0 .. c_source_basename.len - std.fs.path.extension(c_source_basename).len]; | |
| 1718 | 1718 | const o_basename = try std.fmt.allocPrint(arena, "{s}{s}", .{ o_basename_noext, comp.getTarget().oFileExt() }); |
| 1719 | 1719 | |
| 1720 | 1720 | const digest = if (!comp.disable_c_depfile and try man.hit()) man.final() else blk: { |
| ... | ... | @@ -2676,7 +2676,7 @@ fn buildOutputFromZig( |
| 2676 | 2676 | }, |
| 2677 | 2677 | .root_src_path = src_basename, |
| 2678 | 2678 | }; |
| 2679 | const root_name = mem.split(src_basename, ".").next().?; | |
| 2679 | const root_name = src_basename[0 .. src_basename.len - std.fs.path.extension(src_basename).len]; | |
| 2680 | 2680 | const target = comp.getTarget(); |
| 2681 | 2681 | const fixed_output_mode = if (target.cpu.arch.isWasm()) .Obj else output_mode; |
| 2682 | 2682 | const bin_basename = try std.zig.binNameAlloc(comp.gpa, .{ |
src/main.zig+4-4| ... | ... | @@ -1310,16 +1310,16 @@ fn buildOutputType( |
| 1310 | 1310 | break :blk "test"; |
| 1311 | 1311 | } else if (root_src_file) |file| { |
| 1312 | 1312 | const basename = fs.path.basename(file); |
| 1313 | break :blk mem.split(basename, ".").next().?; | |
| 1313 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1314 | 1314 | } else if (c_source_files.items.len >= 1) { |
| 1315 | 1315 | const basename = fs.path.basename(c_source_files.items[0].src_path); |
| 1316 | break :blk mem.split(basename, ".").next().?; | |
| 1316 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1317 | 1317 | } else if (link_objects.items.len >= 1) { |
| 1318 | 1318 | const basename = fs.path.basename(link_objects.items[0]); |
| 1319 | break :blk mem.split(basename, ".").next().?; | |
| 1319 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1320 | 1320 | } else if (emit_bin == .yes) { |
| 1321 | 1321 | const basename = fs.path.basename(emit_bin.yes); |
| 1322 | break :blk mem.split(basename, ".").next().?; | |
| 1322 | break :blk basename[0 .. basename.len - fs.path.extension(basename).len]; | |
| 1323 | 1323 | } else if (show_builtin) { |
| 1324 | 1324 | break :blk "builtin"; |
| 1325 | 1325 | } else if (arg_mode == .run) { |
src/musl.zig+1-1| ... | ... | @@ -122,7 +122,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { |
| 122 | 122 | |
| 123 | 123 | const dirname = path.dirname(src_file).?; |
| 124 | 124 | const basename = path.basename(src_file); |
| 125 | const noextbasename = mem.split(basename, ".").next().?; | |
| 125 | const noextbasename = basename[0 .. basename.len - std.fs.path.extension(basename).len]; | |
| 126 | 126 | const before_arch_dir = path.dirname(dirname).?; |
| 127 | 127 | const dirbasename = path.basename(dirname); |
| 128 | 128 |