diff --git a/src/Compilation.zig b/src/Compilation.zig index 9c1117966d86..9482c311810e 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4244,7 +4244,18 @@ fn docsCopyModule(comp: *Compilation, module: *Package.Module, name: []const u8, }); }; defer file.close(); - archiver.writeFile(entry.path, file) catch |err| { + + const path = if (std.fs.path.sep == '/') entry.path else blk: { + const new_path = try comp.arena.dupe(u8, entry.path); + for (new_path) |*byte| { + if (byte.* == std.fs.path.sep) { + byte.* = '/'; + } + } + break :blk new_path; + }; + + archiver.writeFile(path, file) catch |err| { return comp.lockAndSetMiscFailure(.docs_copy, "unable to archive '{}{s}': {s}", .{ root, entry.path, @errorName(err), });