[Cmake-commits] CMake branch, master, updated. v2.8.2-289-g735a8c2

KWSys Robot kwrobot at kitware.com
Fri Aug 27 10:50:10 EDT 2010


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, master has been updated
       via  735a8c26d749d3a1e7a539386161ed98e22c9005 (commit)
      from  3bf1869c93daf131e8040e88f20986cf01bb9779 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=735a8c26d749d3a1e7a539386161ed98e22c9005
commit 735a8c26d749d3a1e7a539386161ed98e22c9005
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Aug 27 10:46:35 2010 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Aug 27 10:50:02 2010 -0400

    KWSys: Use SplitPath in GetActualCaseForPath
    
    Avoid using the old SplitString method in favor of the more robust
    SplitPath method.

diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 5002a06..8aa99eb 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3063,30 +3063,35 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
 static int GetCasePathName(const kwsys_stl::string & pathIn,
                             kwsys_stl::string & casePath)
 {
-  kwsys_stl::vector<kwsys::String> path_components =
-    SystemTools::SplitString(pathIn.c_str(), '/', true);
-  if(path_components.empty())
+  kwsys_stl::vector<kwsys_stl::string> path_components;
+  SystemTools::SplitPath(pathIn.c_str(), path_components);
+  if(path_components[0].empty()) // First component always exists.
     {
+    // Relative paths cannot be converted.
     casePath = "";
     return 0;
     }
+
+  // Start with root component.
   kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
-  // assume always absolute path, so just take first
   casePath = path_components[idx++];
+  const char* sep = "";
+
   // If network path, fill casePath with server/share so FindFirstFile
   // will work after that.  Maybe someday call other APIs to get
   // actual case of servers and shares.
-  if(path_components.size() > 2 && pathIn.size() >= 2 &&
-     pathIn[0] == '/' && pathIn[1] == '/')
+  if(path_components.size() > 2 && path_components[0] == "//")
     {
     casePath += path_components[idx++];
     casePath += "/";
     casePath += path_components[idx++];
+    sep = "/";
     }
 
   for(; idx < path_components.size(); idx++)
     {
-    casePath += "/";
+    casePath += sep;
+    sep = "/";
     kwsys_stl::string test_str = casePath;
     test_str += path_components[idx];
 

-----------------------------------------------------------------------

Summary of changes:
 Source/kwsys/SystemTools.cxx |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list