diff options
author | Brad King <brad.king@kitware.com> | 2004-01-22 15:30:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2004-01-22 15:30:01 (GMT) |
commit | 49bd89fe31f9a5d064c9ae863798349838badc21 (patch) | |
tree | db2c4fc838ed7fa88d1ed2acf4e55436508aa6c0 /Source/cmake.cxx | |
parent | f9a3f74d87a875e172c8128a3e2e5d215a54dd31 (diff) | |
download | CMake-49bd89fe31f9a5d064c9ae863798349838badc21.zip CMake-49bd89fe31f9a5d064c9ae863798349838badc21.tar.gz CMake-49bd89fe31f9a5d064c9ae863798349838badc21.tar.bz2 |
BUG: CopyFileIfDifferent should return success if the files did not differ or if the copy succeeded. It should return failure only if the files were different and the copy failed.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8416fe2..50170c6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -660,15 +660,26 @@ int cmake::CMakeCommand(std::vector<std::string>& args) // Copy file if (args[1] == "copy" && args.size() == 4) { - cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str()); - return cmSystemTools::GetErrorOccuredFlag(); + if(!cmSystemTools::cmCopyFile(args[2].c_str(), args[3].c_str())) + { + std::cerr << "Error copying file \"" << args[2].c_str() + << "\" to \"" << args[3].c_str() << "\".\n"; + return 1; + } + return 0; } // Copy file if different. if (args[1] == "copy_if_different" && args.size() == 4) { - cmSystemTools::CopyFileIfDifferent(args[2].c_str(), args[3].c_str()); - return cmSystemTools::GetErrorOccuredFlag(); + if(!cmSystemTools::CopyFileIfDifferent(args[2].c_str(), args[3].c_str())) + { + std::cerr << "Error copying file (if different) from \"" + << args[2].c_str() << "\" to \"" << args[3].c_str() + << "\".\n"; + return 1; + } + return 0; } // Echo string |