diff options
Diffstat (limited to 'lib/Support/Windows/PathV2.inc')
-rw-r--r-- | lib/Support/Windows/PathV2.inc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Support/Windows/PathV2.inc b/lib/Support/Windows/PathV2.inc index 23f3d14..ea38389 100644 --- a/lib/Support/Windows/PathV2.inc +++ b/lib/Support/Windows/PathV2.inc @@ -362,6 +362,17 @@ error_code exists(const Twine &path, bool &result) { return error_code::success(); } +bool can_execute(const Twine &Path) { + SmallString<128> PathStorage; + SmallVector<wchar_t, 128> PathUtf16; + + if (UTF8ToUTF16(Path.toStringRef(PathStorage), PathUtf16)) + return false; + + DWORD Attr = ::GetFileAttributesW(PathUtf16.begin()); + return Attr != INVALID_FILE_ATTRIBUTES; +} + bool equivalent(file_status A, file_status B) { assert(status_known(A) && status_known(B)); return A.FileIndexHigh == B.FileIndexHigh && |