diff options
author | Brad King <brad.king@kitware.com> | 2006-05-30 15:15:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-05-30 15:15:27 (GMT) |
commit | d9e060e0625edfe523210f66e023b3367f5a2775 (patch) | |
tree | f79c1f7f4500da05ed850f5edf1c2288032af1bb /Source/cmake.cxx | |
parent | 1d93480780830306ad73b5dcc9d3ccc38a7c635c (diff) | |
download | CMake-d9e060e0625edfe523210f66e023b3367f5a2775.zip CMake-d9e060e0625edfe523210f66e023b3367f5a2775.tar.gz CMake-d9e060e0625edfe523210f66e023b3367f5a2775.tar.bz2 |
BUG: Fixed cmake -E remove return code.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 0867701..6bbf9d1 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -899,15 +899,22 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args) // Remove file else if (args[1] == "remove" && args.size() > 2) { + bool force = false; for (std::string::size_type cc = 2; cc < args.size(); cc ++) { - if(args[cc] != "-f") + if(args[cc] == "\\-f" || args[cc] == "-f") { - if(args[cc] == "\\-f") + force = true; + } + else + { + // Complain if the file could not be removed, still exists, + // and the -f option was not given. + if(!cmSystemTools::RemoveFile(args[cc].c_str()) && !force && + cmSystemTools::FileExists(args[cc].c_str())) { - args[cc] = "-f"; + return 1; } - cmSystemTools::RemoveFile(args[cc].c_str()); } } return 0; |