summaryrefslogtreecommitdiff
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-09-09 08:46:41 -0400
committerBrad King <brad.king@kitware.com>2014-09-09 08:46:41 -0400
commitdaab3b3bdfdb8f6557730738088bbfad5088ddbc (patch)
tree908ad83d2e8b4305f9a3b838227a7862ac5f9d06 /Source/kwsys/SystemTools.cxx
parent1251c1c8c50fccbd73b48cf8b13b3432845fc320 (diff)
parent92b582a67e3ea29d7a958952c0a3dfd7706b2c9f (diff)
downloadcmake-daab3b3bdfdb8f6557730738088bbfad5088ddbc.tar.gz
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index e34bb431eb..8a61267c92 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3425,9 +3425,12 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons
return "";
}
+ kwsys_stl::string l = SystemTools::CollapseFullPath(local);
+ kwsys_stl::string r = SystemTools::CollapseFullPath(remote);
+
// split up both paths into arrays of strings using / as a separator
- kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
- kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
+ kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true);
+ kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true);
kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here
// count up how many matching directory names there are from the start
@@ -3533,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);