Use Path::getFileStatus

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-08-01 18:09:46 +00:00
parent 0b32d8b764
commit 8bdbb04f9b

View File

@ -270,19 +270,22 @@ ArchiveOperation parseCommandLine() {
// finds with all the files in that directory (recursively). It uses the
// sys::Path::getDirectoryContent method to perform the actual directory scans.
std::set<sys::Path> recurseDirectories(const sys::Path& path) {
assert(path.isDirectory() && "Oops, can't recurse a file");
std::set<sys::Path> result;
if (RecurseDirectories) {
std::set<sys::Path> content;
path.getDirectoryContents(content);
for (std::set<sys::Path>::iterator I = content.begin(), E = content.end();
I != E; ++I) {
if (I->isDirectory()) {
std::set<sys::Path> moreResults = recurseDirectories(*I);
result.insert(moreResults.begin(), moreResults.end());
} else {
result.insert(*I);
}
// Make sure it exists and is a directory
sys::FileStatus Status;
if (!I->getFileStatus(Status)) {
if (Status.isDir) {
std::set<sys::Path> moreResults = recurseDirectories(*I);
result.insert(moreResults.begin(), moreResults.end());
} else {
result.insert(*I);
}
}
}
}
return result;