|
|
@ -27,7 +27,6 @@ |
|
|
|
#include <iostream>
|
|
|
|
#include <set>
|
|
|
|
#include <sstream>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
// Work-around CMake dependency scanning limitation. This must
|
|
|
@ -3254,7 +3253,7 @@ std::string SystemTools::CollapseFullPath(const std::string& in_path, |
|
|
|
|
|
|
|
SystemTools::CheckTranslationPath(newPath); |
|
|
|
#ifdef _WIN32
|
|
|
|
newPath = SystemTools::GetActualCaseForPath(newPath); |
|
|
|
newPath = SystemTools::GetActualCaseForPathCached(newPath); |
|
|
|
SystemTools::ConvertToUnixSlashes(newPath); |
|
|
|
#endif
|
|
|
|
// Return the reconstructed path.
|
|
|
@ -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
|
|
|
|
|
|
|
@ -3412,22 +3411,27 @@ std::string SystemTools::GetActualCaseForPath(const std::string& p) |
|
|
|
#ifndef _WIN32
|
|
|
|
return p; |
|
|
|
#else
|
|
|
|
return GetCasePathName(p); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
std::string SystemTools::GetActualCaseForPathCached(std::string const& p) |
|
|
|
{ |
|
|
|
// Check to see if actual case has already been called
|
|
|
|
// for this path, and the result is stored in the PathCaseMap
|
|
|
|
SystemToolsPathCaseMap::iterator i = SystemTools::PathCaseMap->find(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; |
|
|
|
} |
|
|
|
if (casePath.second) { |
|
|
|
(*SystemTools::PathCaseMap)[p] = casePath.first; |
|
|
|
std::string casePath = GetCasePathName(p); |
|
|
|
if (casePath.size() > MAX_PATH) { |
|
|
|
return casePath; |
|
|
|
} |
|
|
|
return casePath.first; |
|
|
|
#endif
|
|
|
|
(*SystemTools::PathCaseMap)[p] = casePath; |
|
|
|
return casePath; |
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
const char* SystemTools::SplitPathRootComponent(const std::string& p, |
|
|
|
std::string* root) |
|
|
|