Use Path::getFileStatus

llvm-svn: 29445
This commit is contained in:
Chris Lattner 2006-08-01 18:09:46 +00:00
parent 32ffbc316a
commit 63c5e1cf92
1 changed files with 10 additions and 7 deletions

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;