Commit 6bd7ebff authored by Kitware Robot's avatar Kitware Robot Committed by Brad King
Browse files

KWSys 2014-09-19 (6aa1f800)

Extract upstream KWSys using the following shell commands.

$ git archive --prefix=upstream-kwsys/ 6aa1f800 | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' 80e852f6..6aa1f800
Clinton Stimpson (1):
      fb77be5a SystemTools: Fix GetCasePathName to handle wildcards on Windows.

Sean McBride (1):
      6aa1f800 SystemInformation: Fix clang -Wtautological-pointer-compare warning

Change-Id: I8d8a18e3931c674c9db799e1dc0022731858d847
parent 50e1f894
......@@ -3786,7 +3786,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
return false;
}
if( unameInfo.release!=0 && strlen(unameInfo.release)>=3 )
if( strlen(unameInfo.release)>=3 )
{
// release looks like "2.6.3-15mdk-i686-up-4GB"
char majorChar=unameInfo.release[0];
......
......@@ -3536,6 +3536,16 @@ static int GetCasePathName(const kwsys_stl::string & pathIn,
kwsys_stl::string test_str = casePath;
test_str += path_components[idx];
// If path component contains wildcards, we skip matching
// because these filenames are not allowed on windows,
// and we do not want to match a different file.
if(path_components[idx].find('*') != kwsys_stl::string::npos ||
path_components[idx].find('?') != kwsys_stl::string::npos)
{
casePath = "";
return 0;
}
WIN32_FIND_DATAW findData;
HANDLE hFind = ::FindFirstFileW(Encoding::ToWide(test_str).c_str(),
&findData);
......
......@@ -589,6 +589,28 @@ static bool CheckRelativePaths()
return res;
}
static bool CheckCollapsePath(
const kwsys_stl::string& path,
const kwsys_stl::string& expected)
{
kwsys_stl::string result = kwsys::SystemTools::CollapseFullPath(path);
if(expected != result)
{
kwsys_ios::cerr << "CollapseFullPath(" << path
<< ") yielded " << result << " instead of " << expected << kwsys_ios::endl;
return false;
}
return true;
}
static bool CheckCollapsePath()
{
bool res = true;
res &= CheckCollapsePath("/usr/share/*", "/usr/share/*");
res &= CheckCollapsePath("C:/Windows/*", "C:/Windows/*");
return res;
}
//----------------------------------------------------------------------------
int testSystemTools(int, char*[])
{
......@@ -622,5 +644,7 @@ int testSystemTools(int, char*[])
res &= CheckRelativePaths();
res &= CheckCollapsePath();
return res ? 0 : 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