[Cmake-commits] [cmake-commits] king committed cmake.cxx 1.414 1.415
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Apr 15 09:58:35 EDT 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv17666/Source
Modified Files:
cmake.cxx
Log Message:
ENH: Create command line api "cmake -E rename"
This extends the "-E" command line mode with a "rename old new"
signature. The new command atomically renames a file or directory
within a single disk volume.
Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.414
retrieving revision 1.415
diff -C 2 -d -r1.414 -r1.415
*** cmake.cxx 16 Mar 2009 20:55:58 -0000 1.414
--- cmake.cxx 15 Apr 2009 13:58:33 -0000 1.415
***************
*** 956,959 ****
--- 956,961 ----
<< "Available commands: \n"
<< " chdir dir cmd [args]... - run command in a given directory\n"
+ << " rename oldname newname - rename a file or directory "
+ "(on one volume)\n"
<< " copy file destination - copy file to destination (either file "
"or directory)\n"
***************
*** 1034,1037 ****
--- 1036,1053 ----
}
+ // Rename a file or directory
+ if (args[1] == "rename" && args.size() == 4)
+ {
+ if(!cmSystemTools::RenameFile(args[2].c_str(), args[3].c_str()))
+ {
+ std::string e = cmSystemTools::GetLastSystemError();
+ std::cerr << "Error renaming from \""
+ << args[2].c_str() << "\" to \"" << args[3].c_str()
+ << "\": " << e << "\n";
+ return 1;
+ }
+ return 0;
+ }
+
// Compare files
if (args[1] == "compare_files" && args.size() == 4)
More information about the Cmake-commits
mailing list