summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2017-11-09 12:51:32 (GMT)
committerBrad King <brad.king@kitware.com>2017-11-09 13:35:50 (GMT)
commite8d0b4312e0454ed3a0787acb2ecbef2c3a364a9 (patch)
tree9478e094a99bde43d57d321af8e48826656ea172
parentdc059ae70b2ec79bce2b534876a2f4006293d3b6 (diff)
downloadCMake-e8d0b4312e0454ed3a0787acb2ecbef2c3a364a9.zip
CMake-e8d0b4312e0454ed3a0787acb2ecbef2c3a364a9.tar.gz
CMake-e8d0b4312e0454ed3a0787acb2ecbef2c3a364a9.tar.bz2
KWSys 2017-11-09 (40d7b1bb)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 40d7b1bba6abb1a2aea4c2d46a48968fb31a9d7d (master). Upstream Shortlog ----------------- Clinton Stimpson (1): e9d2b696 SystemTools: Cache only existing path names in GetActualCaseForPath
-rw-r--r--SystemTools.cxx19
1 files changed, 11 insertions, 8 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 1f7ee10..50aa857 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -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
}