[Cmake-commits] CMake branch, next, updated. v3.2.0-rc2-756-g96c192e

Brad King brad.king at kitware.com
Thu Feb 26 09:02:43 EST 2015


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  96c192e36385a92ac6e614831fcfffd68c13976a (commit)
       via  266568654c23ee1b4dea487a684cdb6304eb33aa (commit)
       via  5e2b418f7b0083b01004910848eb4823ea014ec1 (commit)
      from  3f52c32ebb037d504c4ebc6797d318fe85747dde (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=96c192e36385a92ac6e614831fcfffd68c13976a
commit 96c192e36385a92ac6e614831fcfffd68c13976a
Merge: 3f52c32 2665686
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 26 09:02:42 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 26 09:02:42 2015 -0500

    Merge topic 'update-kwsys' into next
    
    26656865 Merge branch 'upstream-kwsys' into update-kwsys
    5e2b418f KWSys 2015-02-25 (1b75ad3d)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=266568654c23ee1b4dea487a684cdb6304eb33aa
commit 266568654c23ee1b4dea487a684cdb6304eb33aa
Merge: 4817d28 5e2b418
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Feb 26 08:54:42 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 26 08:54:42 2015 -0500

    Merge branch 'upstream-kwsys' into update-kwsys


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5e2b418f7b0083b01004910848eb4823ea014ec1
commit 5e2b418f7b0083b01004910848eb4823ea014ec1
Author:     KWSys Robot <kwrobot at kitware.com>
AuthorDate: Wed Feb 25 09:31:23 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Feb 26 08:54:37 2015 -0500

    KWSys 2015-02-25 (1b75ad3d)
    
    Extract upstream KWSys using the following shell commands.
    
    $ git archive --prefix=upstream-kwsys/ 1b75ad3d | tar x
    $ git shortlog --no-merges --abbrev=8 --format='%h %s' d4e7f08e..1b75ad3d
    Domen Vrankar (3):
          2b042ff6 SystemTools: Optionally report error from GetRealPath
          7c9a970a Glob: Remove dead code
          1b75ad3d Glob: Remove addition of extra '/'
    
    Change-Id: I04ac5aa4748925bc953db0abff2d4418080882b5

diff --git a/Glob.cxx b/Glob.cxx
index 5a96aed..1476c25 100644
--- a/Glob.cxx
+++ b/Glob.cxx
@@ -223,7 +223,6 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
     return;
     }
   unsigned long cc;
-  kwsys_stl::string fullname;
   kwsys_stl::string realname;
   kwsys_stl::string fname;
   for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
@@ -248,15 +247,6 @@ void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
     fname = kwsys::SystemTools::LowerCase(fname);
 #endif
 
-    if ( start == 0 )
-      {
-      fullname = dir + fname;
-      }
-    else
-      {
-      fullname = dir + "/" + fname;
-      }
-
     bool isDir = kwsys::SystemTools::FileIsDirectory(realname);
     bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname);
 
@@ -302,7 +292,6 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
     return;
     }
   unsigned long cc;
-  kwsys_stl::string fullname;
   kwsys_stl::string realname;
   kwsys_stl::string fname;
   for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
@@ -327,19 +316,10 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
     fname = kwsys::SystemTools::LowerCase(fname);
 #endif
 
-    if ( start == 0 )
-      {
-      fullname = dir + fname;
-      }
-    else
-      {
-      fullname = dir + "/" + fname;
-      }
-
     //kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl;
     //kwsys_ios::cout << "Match: "
     // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl;
-    //kwsys_ios::cout << "Full name: " << fullname << kwsys_ios::endl;
+    //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl;
 
     if ( !last &&
       !kwsys::SystemTools::FileIsDirectory(realname) )
@@ -355,7 +335,7 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
         }
       else
         {
-        this->ProcessDirectory(start+1, realname + "/");
+        this->ProcessDirectory(start+1, realname);
         }
       }
     }
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 2708211..bf6f458 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -250,17 +250,46 @@ inline int Chdir(const kwsys_stl::string& dir)
   return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
   #endif
 }
-inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path)
+inline void Realpath(const kwsys_stl::string& path,
+                     kwsys_stl::string& resolved_path,
+                     kwsys_stl::string* errorMessage = 0)
 {
   kwsys_stl::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
   wchar_t *ptemp;
   wchar_t fullpath[MAX_PATH];
-  if( GetFullPathNameW(tmp.c_str(), sizeof(fullpath)/sizeof(fullpath[0]),
-                       fullpath, &ptemp) )
+  DWORD bufferLen = GetFullPathNameW(tmp.c_str(),
+      sizeof(fullpath) / sizeof(fullpath[0]),
+      fullpath, &ptemp);
+  if( bufferLen < sizeof(fullpath)/sizeof(fullpath[0]) )
     {
     resolved_path = KWSYS_NAMESPACE::Encoding::ToNarrow(fullpath);
     KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path);
     }
+  else if(errorMessage)
+    {
+    if(bufferLen)
+      {
+      *errorMessage = "Destination path buffer size too small.";
+      }
+    else if(unsigned int errorId = GetLastError())
+      {
+      LPSTR message = NULL;
+      DWORD size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
+                                   | FORMAT_MESSAGE_FROM_SYSTEM
+                                   | FORMAT_MESSAGE_IGNORE_INSERTS,
+                                   NULL, errorId,
+                                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                                   (LPSTR)&message, 0, NULL);
+      *errorMessage = std::string(message, size);
+      LocalFree(message);
+      }
+    else
+      {
+      *errorMessage = "Unknown error.";
+      }
+
+    resolved_path = "";
+    }
   else
     {
     resolved_path = path;
@@ -287,15 +316,31 @@ inline int Chdir(const kwsys_stl::string& dir)
 {
   return chdir(dir.c_str());
 }
-inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path)
+inline void Realpath(const kwsys_stl::string& path,
+                     kwsys_stl::string& resolved_path,
+                     kwsys_stl::string* errorMessage = 0)
 {
   char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
 
+  errno = 0;
   char *ret = realpath(path.c_str(), resolved_name);
   if(ret)
     {
     resolved_path = ret;
     }
+  else if(errorMessage)
+    {
+    if(errno)
+      {
+      *errorMessage = strerror(errno);
+      }
+    else
+      {
+      *errorMessage = "Unknown error.";
+      }
+
+    resolved_path = "";
+    }
   else
     {
     // if path resolution fails, return what was passed in
@@ -3046,10 +3091,11 @@ kwsys_stl::string SystemTools
   return "";
 }
 
-kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path)
+kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path,
+                                           kwsys_stl::string* errorMessage)
 {
   kwsys_stl::string ret;
-  Realpath(path, ret);
+  Realpath(path, ret, errorMessage);
   return ret;
 }
 
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index beb2a7e..93cde02 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -385,9 +385,12 @@ public:
   /** 
    * Get the real path for a given path, removing all symlinks.  In
    * the event of an error (non-existent path, permissions issue,
-   * etc.) the original path is returned.
+   * etc.) the original path is returned if errorMessage pointer is
+   * NULL.  Otherwise empty string is returned and errorMessage
+   * contains error description.
    */
-  static kwsys_stl::string GetRealPath(const kwsys_stl::string& path);
+  static kwsys_stl::string GetRealPath(const kwsys_stl::string& path,
+                                       kwsys_stl::string* errorMessage = 0);
 
   /**
    * Split a path name into its root component and the rest of the

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

Summary of changes:
 Source/kwsys/Glob.cxx           |   24 ++--------------
 Source/kwsys/SystemTools.cxx    |   58 +++++++++++++++++++++++++++++++++++----
 Source/kwsys/SystemTools.hxx.in |    7 +++--
 3 files changed, 59 insertions(+), 30 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list