diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2005-04-15 14:46:19 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2005-04-15 14:46:19 (GMT) |
commit | b1541f3ee5adc63507e3f6e1cfe1a5840d23e3db (patch) | |
tree | 4e4c0f8df95a407d81b96d129482c914f983d1eb /Source/cmTryCompileCommand.cxx | |
parent | 6c68c8147532bbc07e467b6e80cbfbee07b99f26 (diff) | |
download | CMake-b1541f3ee5adc63507e3f6e1cfe1a5840d23e3db.zip CMake-b1541f3ee5adc63507e3f6e1cfe1a5840d23e3db.tar.gz CMake-b1541f3ee5adc63507e3f6e1cfe1a5840d23e3db.tar.bz2 |
BUG: work around for buggy Tigger OSX systems that read two copies of the same file in a directory
Diffstat (limited to 'Source/cmTryCompileCommand.cxx')
-rw-r--r-- | Source/cmTryCompileCommand.cxx | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index df06871..3991f21 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -282,25 +282,32 @@ void cmTryCompileCommand::CleanupFiles(const char* binDir) cmsys::Directory dir; dir.Load(binDir); size_t fileNum; + std::set<cmStdString> deletedFiles; for (fileNum = 0; fileNum < dir.GetNumberOfFiles(); ++fileNum) { if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") && strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),"..")) { - std::string fullPath = binDir; - fullPath += "/"; - fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); - if(cmSystemTools::FileIsDirectory(fullPath.c_str())) + + if(deletedFiles.find( dir.GetFile(static_cast<unsigned long>(fileNum))) + == deletedFiles.end()) { - cmTryCompileCommand::CleanupFiles(fullPath.c_str()); - } - else - { - if(!cmSystemTools::RemoveFile(fullPath.c_str())) + deletedFiles.insert(dir.GetFile(static_cast<unsigned long>(fileNum))); + std::string fullPath = binDir; + fullPath += "/"; + fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); + if(cmSystemTools::FileIsDirectory(fullPath.c_str())) + { + cmTryCompileCommand::CleanupFiles(fullPath.c_str()); + } + else { - std::string m = "Remove failed on file: "; - m += fullPath; - cmSystemTools::ReportLastSystemError(m.c_str()); + if(!cmSystemTools::RemoveFile(fullPath.c_str())) + { + std::string m = "Remove failed on file: "; + m += fullPath; + cmSystemTools::ReportLastSystemError(m.c_str()); + } } } } |