BUG: work around for buggy Tigger OSX systems that read two copies of the same file in a directory
This commit is contained in:
parent
6c68c81475
commit
b1541f3ee5
|
@ -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()))
|
||||
{
|
||||
std::string m = "Remove failed on file: ";
|
||||
m += fullPath;
|
||||
cmSystemTools::ReportLastSystemError(m.c_str());
|
||||
cmTryCompileCommand::CleanupFiles(fullPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!cmSystemTools::RemoveFile(fullPath.c_str()))
|
||||
{
|
||||
std::string m = "Remove failed on file: ";
|
||||
m += fullPath;
|
||||
cmSystemTools::ReportLastSystemError(m.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue