diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-12-18 19:46:22 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-12-18 19:46:22 +0000 |
commit | 74db04261b44e2a107eccf8554cb9bab1e05b5a4 (patch) | |
tree | 8f87189a523e65bf72fc9ae63ccd87ee0bf273c1 /llvm/lib/System/Unix | |
parent | 483a969eceb24b62f83f178f294432593d40069e (diff) | |
download | bcm5719-llvm-74db04261b44e2a107eccf8554cb9bab1e05b5a4.tar.gz bcm5719-llvm-74db04261b44e2a107eccf8554cb9bab1e05b5a4.zip |
Added "isDirectory" method to llvm::sys::Path.
llvm-svn: 45168
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index e4916baf280..9e90dda04e0 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -289,6 +289,14 @@ Path::exists() const { } bool +Path::isDirectory() const { + struct stat buf; + if (0 != stat(path.c_str(), &buf)) + return false; + return buf.st_mode & S_IFDIR ? true : false; +} + +bool Path::canRead() const { return 0 == access(path.c_str(), F_OK | R_OK ); } |