[Cmake-commits] CMake branch, next, updated. v3.6.2-2029-gd0cd09f
Brad King
brad.king at kitware.com
Wed Sep 14 09:50:02 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via d0cd09fd67005deb08f59b7ecc5276ea373afca8 (commit)
via 04d94fbe92535f57177777bc8715fb41a2d7dcc0 (commit)
via d28e4467aae44db2b15a785e6f061917798cfcd4 (commit)
from 4ce64ff92d4a22e935fe3048bc7446c667c210f6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d0cd09fd67005deb08f59b7ecc5276ea373afca8
commit d0cd09fd67005deb08f59b7ecc5276ea373afca8
Merge: 4ce64ff 04d94fb
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 14 09:50:01 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Sep 14 09:50:01 2016 -0400
Merge topic 'update-kwsys' into next
04d94fbe Merge branch 'upstream-KWSys' into update-kwsys
d28e4467 KWSys 2016-09-14 (c4049689)
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=04d94fbe92535f57177777bc8715fb41a2d7dcc0
commit 04d94fbe92535f57177777bc8715fb41a2d7dcc0
Merge: e4fc770 d28e446
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Sep 14 09:43:32 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 14 09:49:37 2016 -0400
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys:
KWSys 2016-09-14 (c4049689)
Issue: #16295
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d28e4467aae44db2b15a785e6f061917798cfcd4
commit d28e4467aae44db2b15a785e6f061917798cfcd4
Author: KWSys Upstream <kwrobot at kitware.com>
AuthorDate: Wed Sep 14 09:38:50 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Sep 14 09:43:31 2016 -0400
KWSys 2016-09-14 (c4049689)
Code extracted from:
http://public.kitware.com/KWSys.git
at commit c4049689d1ff6e3b9f59358023aebb1a7e0fd149 (master).
Upstream Shortlog
-----------------
Brad King (2):
0504dcaf SystemTools: Fix path comparison in test case
c4049689 SystemTools: Teach GetActualCaseForPath to convert as much as possible
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 1a73b16..4281c38 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -3982,16 +3982,16 @@ std::string SystemTools::RelativePath(const std::string& local, const std::strin
}
#ifdef _WIN32
-static int GetCasePathName(const std::string & pathIn,
- std::string & casePath)
+static std::string GetCasePathName(std::string const& pathIn)
{
+ std::string casePath;
std::vector<std::string> path_components;
SystemTools::SplitPath(pathIn, path_components);
if(path_components[0].empty()) // First component always exists.
{
// Relative paths cannot be converted.
- casePath = "";
- return 0;
+ casePath = pathIn;
+ return casePath;
}
// Start with root component.
@@ -4015,38 +4015,45 @@ static int GetCasePathName(const std::string & pathIn,
sep = "/";
}
+ // Convert case of all components that exist.
+ bool converting = true;
for(; idx < path_components.size(); idx++)
{
casePath += sep;
sep = "/";
- std::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('*') != std::string::npos ||
- path_components[idx].find('?') != std::string::npos)
- {
- casePath = "";
- return 0;
- }
- WIN32_FIND_DATAW findData;
- HANDLE hFind = ::FindFirstFileW(Encoding::ToWide(test_str).c_str(),
- &findData);
- if (INVALID_HANDLE_VALUE != hFind)
- {
- casePath += Encoding::ToNarrow(findData.cFileName);
- ::FindClose(hFind);
- }
- else
+ if (converting)
{
- casePath = "";
- return 0;
+ // 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('*') != std::string::npos ||
+ path_components[idx].find('?') != std::string::npos)
+ {
+ converting = false;
+ }
+ else
+ {
+ std::string test_str = casePath;
+ test_str += path_components[idx];
+ WIN32_FIND_DATAW findData;
+ HANDLE hFind = ::FindFirstFileW(Encoding::ToWide(test_str).c_str(),
+ &findData);
+ if (INVALID_HANDLE_VALUE != hFind)
+ {
+ path_components[idx] = Encoding::ToNarrow(findData.cFileName);
+ ::FindClose(hFind);
+ }
+ else
+ {
+ converting = false;
+ }
+ }
}
+
+ casePath += path_components[idx];
}
- return (int)casePath.size();
+ return casePath;
}
#endif
@@ -4065,11 +4072,10 @@ std::string SystemTools::GetActualCaseForPath(const std::string& p)
{
return i->second;
}
- std::string casePath;
- int len = GetCasePathName(p, casePath);
- if(len == 0 || len > MAX_PATH+1)
+ std::string casePath = GetCasePathName(p);
+ if (casePath.size() > MAX_PATH)
{
- return p;
+ return casePath;
}
(*SystemTools::PathCaseMap)[p] = casePath;
return casePath;
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index 28ff0b3..5849145 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -374,10 +374,11 @@ public:
static const char* GetExecutableExtension();
/**
- * Given a path that exists on a windows machine, return the
- * actuall case of the path as it was created. If the file
- * does not exist path is returned unchanged. This does nothing
- * on unix but return path.
+ * Given a path on a Windows machine, return the actual case of
+ * the path as it exists on disk. Path components that do not
+ * exist on disk are returned unchanged. Relative paths are always
+ * returned unchanged. Drive letters are always made upper case.
+ * This does nothing on non-Windows systems but return the path.
*/
static std::string GetActualCaseForPath(const std::string& path);
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 9252ea6..880b46e 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -940,7 +940,7 @@ static bool CheckRelativePath(
const std::string& expected)
{
std::string result = kwsys::SystemTools::RelativePath(local, remote);
- if(expected != result)
+ if (!kwsys::SystemTools::ComparePath(expected, result))
{
std::cerr << "RelativePath(" << local << ", " << remote
<< ") yielded " << result << " instead of " << expected << std::endl;
@@ -965,7 +965,7 @@ static bool CheckCollapsePath(
const std::string& expected)
{
std::string result = kwsys::SystemTools::CollapseFullPath(path);
- if(expected != result)
+ if (!kwsys::SystemTools::ComparePath(expected, result))
{
std::cerr << "CollapseFullPath(" << path
<< ") yielded " << result << " instead of " << expected << std::endl;
-----------------------------------------------------------------------
Summary of changes:
Source/kwsys/SystemTools.cxx | 70 +++++++++++++++++++++-----------------
Source/kwsys/SystemTools.hxx.in | 9 ++---
Source/kwsys/testSystemTools.cxx | 4 +--
3 files changed, 45 insertions(+), 38 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list