diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-07 04:36:50 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-11-07 04:36:50 +0000 |
commit | 559b8fbffcb4b6ed8427d732a7325740d85903a6 (patch) | |
tree | 67f9f71bfe56122def28bd06104465a7dbd2da03 /llvm/lib/System/Unix/Path.inc | |
parent | 2faab302e0d6c369b95b200ff4e140516782c8b6 (diff) | |
download | bcm5719-llvm-559b8fbffcb4b6ed8427d732a7325740d85903a6.tar.gz bcm5719-llvm-559b8fbffcb4b6ed8427d732a7325740d85903a6.zip |
Add method for checking if a path is a symbolic link.
llvm-svn: 118367
Diffstat (limited to 'llvm/lib/System/Unix/Path.inc')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index d5b7542757d..5ee3adc4d2d 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -434,6 +434,15 @@ Path::isDirectory() const { } bool +Path::isSymLink() const { + struct stat buf; + if (0 != lstat(path.c_str(), &buf)) + return false; + return S_ISLNK(buf.st_mode); +} + + +bool Path::canRead() const { return 0 == access(path.c_str(), R_OK); } |