Skip to content

Commit

Permalink
Replace slashes in filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
akenmorris committed Feb 14, 2024
1 parent a156854 commit a1c63b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Libs/Project/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
Expand Down

0 comments on commit a1c63b7

Please sign in to comment.