For PR797:

Remove exception throwing from Path::getDirectoryContents and its users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29841 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-08-23 06:56:27 +00:00
parent e5c9cb5eb6
commit 142ca8e818
5 changed files with 111 additions and 74 deletions

View File

@ -415,10 +415,12 @@ bool Path::makeExecutableOnDisk(std::string* ErrMsg) {
}
bool
Path::getDirectoryContents(std::set<Path>& result) const {
Path::getDirectoryContents(std::set<Path>& result, std::string* ErrMsg) const {
DIR* direntries = ::opendir(path.c_str());
if (direntries == 0)
ThrowErrno(path + ": can't open directory");
if (direntries == 0) {
MakeErrMsg(ErrMsg, path + ": can't open directory");
return true;
}
std::string dirPath = path;
if (!lastIsSlash(dirPath))
@ -433,14 +435,15 @@ Path::getDirectoryContents(std::set<Path>& result) const {
if (0 != lstat(aPath.path.c_str(), &st)) {
if (S_ISLNK(st.st_mode))
continue; // dangling symlink -- ignore
ThrowErrno(aPath.path + ": can't determine file object type");
MakeErrMsg(ErrMsg, aPath.path + ": can't determine file object type");
return true;
}
result.insert(aPath);
}
}
closedir(direntries);
return true;
return false;
}
bool