From a1c63b7112ee579b32dd051e09643c6b73516d33 Mon Sep 17 00:00:00 2001 From: Alan Morris Date: Tue, 13 Feb 2024 21:36:37 -0700 Subject: [PATCH] Replace slashes in filenames --- Libs/Project/Project.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Libs/Project/Project.cpp b/Libs/Project/Project.cpp index 036ac86f26..48415a4617 100644 --- a/Libs/Project/Project.cpp +++ b/Libs/Project/Project.cpp @@ -94,8 +94,10 @@ void Project::set_project_path(const std::string& new_pathname) { auto fixup = [&](StringList paths) { StringList new_paths; - for (const auto& path : paths) { + for (auto path : paths) { if (fs::exists(path)) { + // replace \ with / in path + path = StringUtils::replace_string(path, "\\", "/"); auto canonical = fs::canonical(path, old_path); new_paths.push_back(fs::relative(canonical, new_path).string()); } else { @@ -116,7 +118,10 @@ void Project::set_project_path(const std::string& new_pathname) { auto features = subject->get_feature_filenames(); project::types::StringMap new_features; for (auto const& x : features) { - auto canonical = fs::canonical(x.second, old_path); + auto path = x.second; + // replace \ with / in path + path = StringUtils::replace_string(path, "\\", "/"); + auto canonical = fs::canonical(path, old_path); new_features[x.first] = fs::relative(canonical, new_path).string(); } subject->set_feature_filenames(new_features);