[cmake-commits] andy committed cmake.cxx 1.278 1.279

cmake-commits at cmake.org cmake-commits at cmake.org
Thu Feb 15 15:07:18 EST 2007


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

Modified Files:
	cmake.cxx 
Log Message:
BUG: Overwrite the symlink if it already exists. Close Bug #4418 - cmake -create-symlink doesn't overwrite existing symlinks


Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.278
retrieving revision 1.279
diff -u -d -r1.278 -r1.279
--- cmake.cxx	11 Dec 2006 15:26:10 -0000	1.278
+++ cmake.cxx	15 Feb 2007 20:07:16 -0000	1.279
@@ -1072,6 +1072,22 @@
     // supporting them.
     else if (args[1] == "create_symlink" && args.size() == 4)
       {
+      const char* destinationFileName = args[3].c_str();
+      if ( cmSystemTools::FileExists(destinationFileName) )
+        {
+        if ( cmSystemTools::FileIsSymlink(destinationFileName) )
+          {
+          if ( !cmSystemTools::RemoveFile(destinationFileName) ||
+            cmSystemTools::FileExists(destinationFileName) )
+            {
+            return 0;
+            }
+          }
+        else
+          {
+          return 0;
+          }
+        }
       return cmSystemTools::CreateSymlink(args[2].c_str(),
                                           args[3].c_str())? 0:1;
       }



More information about the Cmake-commits mailing list