[cmake-commits] king committed SystemTools.cxx 1.219 1.220

cmake-commits at cmake.org cmake-commits at cmake.org
Sun Jan 20 17:24:48 EST 2008


Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv1013/Source/kwsys

Modified Files:
	SystemTools.cxx 
Log Message:
BUG: Make sure search paths never have double-slashes.  Leading with two slashes (//) on cygwin looks like a network path and delays while waiting for a non-existent machine.


Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.219
retrieving revision 1.220
diff -u -d -r1.219 -r1.220
--- SystemTools.cxx	12 Jan 2008 14:52:50 -0000	1.219
+++ SystemTools.cxx	20 Jan 2008 22:24:46 -0000	1.220
@@ -2112,13 +2112,22 @@
     {
     path.push_back(*i);
     }
+  // Add a trailing slash to all paths to aid the search process.
+  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+      i != path.end(); ++i)
+    {
+    kwsys_stl::string& p = *i;
+    if(p[p.size()-1] != '/')
+      {
+      p += "/";
+      }
+    }
   // now look for the file
   kwsys_stl::string tryPath;
   for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
       p != path.end(); ++p)
     {
     tryPath = *p;
-    tryPath += "/";
     tryPath += name;
     if(SystemTools::FileExists(tryPath.c_str()))
       {
@@ -2235,6 +2244,16 @@
     {
     path.push_back(*i);
     }
+  // Add a trailing slash to all paths to aid the search process.
+  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+      i != path.end(); ++i)
+    {
+    kwsys_stl::string& p = *i;
+    if(p[p.size()-1] != '/')
+      {
+      p += "/";
+      }
+    }
   // Try each path
   for(kwsys_stl::vector<kwsys_stl::string>::iterator p = path.begin();
       p != path.end(); ++p)
@@ -2250,7 +2269,6 @@
             = extensions.begin(); ext != extensions.end(); ++ext)
         {
         tryPath = *p;
-        tryPath += "/";
         tryPath += name;
         tryPath += *ext;
         if(SystemTools::FileExists(tryPath.c_str()) &&
@@ -2262,7 +2280,6 @@
       }
     // now try it without them
     tryPath = *p;
-    tryPath += "/";
     tryPath += name;
     if(SystemTools::FileExists(tryPath.c_str()) &&
        !SystemTools::FileIsDirectory(tryPath.c_str()))
@@ -2319,13 +2336,22 @@
     {
     path.push_back(*i);
     }
+  // Add a trailing slash to all paths to aid the search process.
+  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
+      i != path.end(); ++i)
+    {
+    kwsys_stl::string& p = *i;
+    if(p[p.size()-1] != '/')
+      {
+      p += "/";
+      }
+    }
   kwsys_stl::string tryPath;
   for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
       p != path.end(); ++p)
     {
 #if defined(__APPLE__)
     tryPath = *p;
-    tryPath += "/";
     tryPath += name;
     tryPath += ".framework";
     if(SystemTools::FileExists(tryPath.c_str())
@@ -2336,7 +2362,6 @@
 #endif
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
     tryPath = *p;
-    tryPath += "/";
     tryPath += name;
     tryPath += ".lib";
     if(SystemTools::FileExists(tryPath.c_str())
@@ -2346,7 +2371,7 @@
       }
 #else
     tryPath = *p;
-    tryPath += "/lib";
+    tryPath += "lib";
     tryPath += name;
     tryPath += ".so";
     if(SystemTools::FileExists(tryPath.c_str())
@@ -2355,7 +2380,7 @@
       return SystemTools::CollapseFullPath(tryPath.c_str());
       }
     tryPath = *p;
-    tryPath += "/lib";
+    tryPath += "lib";
     tryPath += name;
     tryPath += ".a";
     if(SystemTools::FileExists(tryPath.c_str())
@@ -2364,7 +2389,7 @@
       return SystemTools::CollapseFullPath(tryPath.c_str());
       }
     tryPath = *p;
-    tryPath += "/lib";
+    tryPath += "lib";
     tryPath += name;
     tryPath += ".sl";
     if(SystemTools::FileExists(tryPath.c_str())
@@ -2373,7 +2398,7 @@
       return SystemTools::CollapseFullPath(tryPath.c_str());
       }
     tryPath = *p;
-    tryPath += "/lib";
+    tryPath += "lib";
     tryPath += name;
     tryPath += ".dylib";
     if(SystemTools::FileExists(tryPath.c_str())
@@ -2382,7 +2407,7 @@
       return SystemTools::CollapseFullPath(tryPath.c_str());
       }
     tryPath = *p;
-    tryPath += "/lib";
+    tryPath += "lib";
     tryPath += name;
     tryPath += ".dll";
     if(SystemTools::FileExists(tryPath.c_str())



More information about the Cmake-commits mailing list