Add method for checking if a path is a symbolic link.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index d5b7542..5ee3adc 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -434,6 +434,15 @@
}
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);
}