Skip to content

Commit ecae4ff

Browse files
committed
build: the applied table spells a source as the step record does, with forward slashes
1 parent cfba005 commit ecae4ff

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/build/ninja_backend.cppm‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,11 +1335,17 @@ void write_buildopt_sidecar(const BuildPlan& plan) {
13351335
namespace advice = mcpp::buildopt::advice;
13361336
advice::Applied applied;
13371337
std::map<std::string, advice::Fragment> fragments;
1338+
// As the step record spells a source: with forward slashes, whatever the host.
1339+
const auto spelled = [](const std::filesystem::path& p) {
1340+
auto s = mcpplibs::os::fs::utf8(p);
1341+
std::ranges::replace(s, '\\', '/');
1342+
return s;
1343+
};
13381344
for (auto const& cu : plan.compileUnits) {
1339-
const auto source = mcpplibs::os::fs::utf8(cu.source);
1345+
const auto source = spelled(cu.source);
13401346
if (!cu.writtenAs.empty()) {
1341-
auto& f = fragments[mcpplibs::os::fs::utf8(cu.writtenAs)];
1342-
f.written = mcpplibs::os::fs::utf8(cu.writtenAs);
1347+
auto& f = fragments[spelled(cu.writtenAs)];
1348+
f.written = spelled(cu.writtenAs);
13431349
f.units.push_back(source);
13441350
}
13451351
if (!cu.imports.empty() && !cu.servedFromCache) applied.importers.push_back({source, cu.imports});

0 commit comments

Comments
 (0)