summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-12-18 19:46:22 +0000
committerTed Kremenek <kremenek@apple.com>2007-12-18 19:46:22 +0000
commit74db04261b44e2a107eccf8554cb9bab1e05b5a4 (patch)
tree8f87189a523e65bf72fc9ae63ccd87ee0bf273c1 /llvm/lib/System/Unix
parent483a969eceb24b62f83f178f294432593d40069e (diff)
downloadbcm5719-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.inc8
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 );
}
OpenPOWER on IntegriCloud