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 | fd52711675cb581e7672f131046e355a2b5ba167 (patch) | |
tree | 109d63b4c000db4e87f7bbdf5c6fe84d52e8de73 /lib/System/Unix | |
parent | 636e5a216c8dab7567b5e5d8d1c7d982f507f7eb (diff) | |
download | external_llvm-fd52711675cb581e7672f131046e355a2b5ba167.zip external_llvm-fd52711675cb581e7672f131046e355a2b5ba167.tar.gz external_llvm-fd52711675cb581e7672f131046e355a2b5ba167.tar.bz2 |
Added "isDirectory" method to llvm::sys::Path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
-rw-r--r-- | lib/System/Unix/Path.inc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index e4916ba..9e90dda 100644 --- a/lib/System/Unix/Path.inc +++ b/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 ); } |