mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Implement functionality suggested from code review: getStatusInfo should
returnn false if the file doesn't exist rather than throw ane exception. llvm-svn: 17809
This commit is contained in:
parent
32924c8d62
commit
2012d091b2
@ -239,8 +239,10 @@ Path::getLast() const {
|
||||
return path.substr(pos+1);
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
Path::getStatusInfo(StatusInfo& info) {
|
||||
if (!isFile() || !readable())
|
||||
return false;
|
||||
struct stat buf;
|
||||
if (0 != stat(path.c_str(), &buf)) {
|
||||
ThrowErrno(std::string("Can't get status: ")+path);
|
||||
@ -253,6 +255,7 @@ Path::getStatusInfo(StatusInfo& info) {
|
||||
info.isDir = S_ISDIR(buf.st_mode);
|
||||
if (info.isDir && path[path.length()-1] != '/')
|
||||
path += '/';
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user