Commit 86a24794 authored by Brad King's avatar Brad King
Browse files

SystemTools: Fix GetActualCaseForPath drive letter case handling

Convert the drive letter to upper case in the actual output value
instead of just our internal memoization map key.  This was broken by
commit 08b2dcff (Fix GetActualCaseForPath for UNC paths, 2010-08-16).

CMake-Issue: 15642
Change-Id: Iee7148616370d1be4be052c74b7a5d802ad47d93
parent d3ba91e1
......@@ -3690,6 +3690,11 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
// Start with root component.
kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
casePath = path_components[idx++];
// make sure drive letter is always upper case
if(casePath.size() > 1 && casePath[1] == ':')
{
casePath[0] = toupper(casePath[0]);
}
const char* sep = "";
// If network path, fill casePath with server/share so FindFirstFile
......@@ -3745,21 +3750,15 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p)
#ifndef _WIN32
return p;
#else
kwsys_stl::string casePath = p;
// make sure drive letter is always upper case
if(casePath.size() > 1 && casePath[1] == ':')
{
casePath[0] = toupper(casePath[0]);
}
// Check to see if actual case has already been called
// for this path, and the result is stored in the LongPathMap
SystemToolsTranslationMap::iterator i =
SystemTools::LongPathMap->find(casePath);
SystemTools::LongPathMap->find(p);
if(i != SystemTools::LongPathMap->end())
{
return i->second;
}
kwsys_stl::string casePath;
int len = GetCasePathName(p, casePath);
if(len == 0 || len > MAX_PATH+1)
{
......
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