Commit 0a0974d0 authored by Brad King's avatar Brad King

SystemTools: Restore unconditional caching in GetActualCaseForPath

This reverts commit e9d2b696 (SystemTools: Cache only existing path
names in GetActualCaseForPath", 2017-11-07).  The lack of caching
introduced a big performance regression in CMake.  Another solution
for the original problem will be needed.
parent 73caabb8
......@@ -27,7 +27,6 @@
#include <iostream>
#include <set>
#include <sstream>
#include <utility>
#include <vector>
// Work-around CMake dependency scanning limitation. This must
......@@ -3342,7 +3341,7 @@ std::string SystemTools::RelativePath(const std::string& local,
}
#ifdef _WIN32
static std::pair<std::string, bool> GetCasePathName(std::string const& pathIn)
static std::string GetCasePathName(std::string const& pathIn)
{
std::string casePath;
std::vector<std::string> path_components;
......@@ -3351,7 +3350,7 @@ static std::pair<std::string, bool> GetCasePathName(std::string const& pathIn)
{
// Relative paths cannot be converted.
casePath = pathIn;
return std::make_pair(casePath, false);
return casePath;
}
// Start with root component.
......@@ -3403,7 +3402,7 @@ static std::pair<std::string, bool> GetCasePathName(std::string const& pathIn)
casePath += path_components[idx];
}
return std::make_pair(casePath, converting);
return casePath;
}
#endif
......@@ -3418,14 +3417,12 @@ std::string SystemTools::GetActualCaseForPath(const std::string& p)
if (i != SystemTools::PathCaseMap->end()) {
return i->second;
}
std::pair<std::string, bool> casePath = GetCasePathName(p);
if (casePath.first.size() > MAX_PATH) {
return casePath.first;
std::string casePath = GetCasePathName(p);
if (casePath.size() > MAX_PATH) {
return casePath;
}
if (casePath.second) {
(*SystemTools::PathCaseMap)[p] = casePath.first;
}
return casePath.first;
(*SystemTools::PathCaseMap)[p] = casePath;
return casePath;
#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