diff --git a/SystemTools.cxx b/SystemTools.cxx index 3e91a07593a7272e40c23bf24b6ccf7b9e42ba2c..106afe5070e27983c903f995745f4626592d9ed3 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -3253,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. @@ -3411,6 +3411,13 @@ 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); @@ -3423,8 +3430,8 @@ std::string SystemTools::GetActualCaseForPath(const std::string& p) } (*SystemTools::PathCaseMap)[p] = casePath; return casePath; -#endif } +#endif const char* SystemTools::SplitPathRootComponent(const std::string& p, std::string* root) diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 719d45c0577db0490ce38ee3a1c2ecb9385bcf76..e79e3fcf98678edabf80b6b6a385f5e3578df441 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -988,6 +988,7 @@ private: */ static SystemToolsTranslationMap* TranslationMap; #ifdef _WIN32 + static std::string GetActualCaseForPathCached(std::string const& path); static SystemToolsPathCaseMap* PathCaseMap; static SystemToolsEnvMap* EnvMap; #endif