[cmake-commits] hoffman committed SystemTools.cxx 1.157.2.13 1.157.2.14 SystemTools.hxx.in 1.59.2.3 1.59.2.4

cmake-commits at cmake.org cmake-commits at cmake.org
Mon May 28 10:07:06 EDT 2007


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

Modified Files:
      Tag: CMake-2-4
	SystemTools.cxx SystemTools.hxx.in 
Log Message:
ENH: merge in changes from branch RC 7


Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.157.2.13
retrieving revision 1.157.2.14
diff -u -d -r1.157.2.13 -r1.157.2.14
--- SystemTools.cxx	16 Mar 2007 22:05:42 -0000	1.157.2.13
+++ SystemTools.cxx	28 May 2007 14:07:04 -0000	1.157.2.14
@@ -2326,6 +2326,44 @@
 #endif
 }
 
+#if defined(_WIN32) && !defined(__CYGWIN__)
+bool SystemTools::CreateSymlink(const char*, const char*)
+{
+  return false;
+}
+#else
+bool SystemTools::CreateSymlink(const char* origName, const char* newName)
+{
+  return symlink(origName, newName) >= 0;
+}
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+bool SystemTools::ReadSymlink(const char*, kwsys_stl::string&)
+{
+  return false;
+}
+#else
+bool SystemTools::ReadSymlink(const char* newName,
+                              kwsys_stl::string& origName)
+{
+  char buf[KWSYS_SYSTEMTOOLS_MAXPATH+1];
+  int count =
+    static_cast<int>(readlink(newName, buf, KWSYS_SYSTEMTOOLS_MAXPATH));
+  if(count >= 0)
+    {
+    // Add null-terminator.
+    buf[count] = 0;
+    origName = buf;
+    return true;
+    }
+  else
+    {
+    return false;
+    }
+}
+#endif
+
 int SystemTools::ChangeDirectory(const char *dir)
 {
   return Chdir(dir);

Index: SystemTools.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.hxx.in,v
retrieving revision 1.59.2.3
retrieving revision 1.59.2.4
diff -u -d -r1.59.2.3 -r1.59.2.4
--- SystemTools.hxx.in	13 Oct 2006 14:52:08 -0000	1.59.2.3
+++ SystemTools.hxx.in	28 May 2007 14:07:04 -0000	1.59.2.4
@@ -588,6 +588,18 @@
     double percent_bin = 0.05);
 
   /**
+   * Create a symbolic link if the platform supports it.  Returns whether
+   * creation succeded.
+   */
+  static bool CreateSymlink(const char* origName, const char* newName);
+
+  /**
+   * Read the contents of a symbolic link.  Returns whether reading
+   * succeded.
+   */
+  static bool ReadSymlink(const char* newName, kwsys_stl::string& origName);
+
+  /**
    * Try to locate the file 'filename' in the directory 'dir'.
    * If 'filename' is a fully qualified filename, the basename of the file is
    * used to check for its existence in 'dir'.



More information about the Cmake-commits mailing list