aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix/PathV2.inc')
-rw-r--r--lib/Support/Unix/PathV2.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc
index 9ea4f9e..a806083 100644
--- a/lib/Support/Unix/PathV2.inc
+++ b/lib/Support/Unix/PathV2.inc
@@ -308,6 +308,12 @@ error_code exists(const Twine &path, bool &result) {
return error_code::success();
}
+bool can_write(const Twine &Path) {
+ SmallString<128> PathStorage;
+ StringRef P = Path.toNullTerminatedStringRef(PathStorage);
+ return 0 == access(P.begin(), W_OK);
+}
+
bool can_execute(const Twine &Path) {
SmallString<128> PathStorage;
StringRef P = Path.toNullTerminatedStringRef(PathStorage);