returnn false if the file doesn't exist rather than throw ane exception.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17809
91177308-0d34-0410-b5e6-
96231b3b80d8
return path.substr(pos+1);
}
return path.substr(pos+1);
}
Path::getStatusInfo(StatusInfo& info) {
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);
struct stat buf;
if (0 != stat(path.c_str(), &buf)) {
ThrowErrno(std::string("Can't get status: ")+path);
info.isDir = S_ISDIR(buf.st_mode);
if (info.isDir && path[path.length()-1] != '/')
path += '/';
info.isDir = S_ISDIR(buf.st_mode);
if (info.isDir && path[path.length()-1] != '/')
path += '/';
return path.substr(pos+1);
}
return path.substr(pos+1);
}
Path::getStatusInfo(StatusInfo& info) {
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);
struct stat buf;
if (0 != stat(path.c_str(), &buf)) {
ThrowErrno(std::string("Can't get status: ")+path);
info.isDir = S_ISDIR(buf.st_mode);
if (info.isDir && path[path.length()-1] != '/')
path += '/';
info.isDir = S_ISDIR(buf.st_mode);
if (info.isDir && path[path.length()-1] != '/')
path += '/';