Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit e9d2b696 authored by Clinton Stimpson's avatar Clinton Stimpson Committed by Brad King

SystemTools: Cache only existing path names in GetActualCaseForPath

Non-existent names may be created later with a different case.
parent 5249a82d
......@@ -27,6 +27,7 @@
#include <iostream>
#include <set>
#include <sstream>
#include <utility>
#include <vector>
// Work-around CMake dependency scanning limitation. This must
......@@ -3372,7 +3373,7 @@ std::string SystemTools::RelativePath(const std::string& local,
}
#ifdef _WIN32
static std::string GetCasePathName(std::string const& pathIn)
static std::pair<std::string, bool> GetCasePathName(std::string const& pathIn)
{
std::string casePath;
std::vector<std::string> path_components;
......@@ -3381,7 +3382,7 @@ static std::string GetCasePathName(std::string const& pathIn)
{
// Relative paths cannot be converted.
casePath = pathIn;
return casePath;
return std::make_pair(casePath, false);
}
// Start with root component.
......@@ -3433,7 +3434,7 @@ static std::string GetCasePathName(std::string const& pathIn)
casePath += path_components[idx];
}
return casePath;
return std::make_pair(casePath, converting);
}
#endif
......@@ -3448,12 +3449,14 @@ std::string SystemTools::GetActualCaseForPath(const std::string& p)
if (i != SystemTools::PathCaseMap->end()) {
return i->second;
}
std::string casePath = GetCasePathName(p);
if (casePath.size() > MAX_PATH) {
return casePath;
std::pair<std::string, bool> casePath = GetCasePathName(p);
if (casePath.first.size() > MAX_PATH) {
return casePath.first;
}
(*SystemTools::PathCaseMap)[p] = casePath;
return casePath;
if (casePath.second) {
(*SystemTools::PathCaseMap)[p] = casePath.first;
}
return casePath.first;
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment