ScanDirForExecutable on Windows fails to find executables with the "exe" extension...
[oota-llvm.git] / lib / Support / Windows / Path.inc
index 3033149980c1e1dd7eac9f5bc7633dc987097002..1ee45c6f362779d934181b88d22e03ff616eb2c2 100644 (file)
@@ -302,6 +302,11 @@ std::error_code access(const Twine &Path, AccessMode Mode) {
   return std::error_code();
 }
 
+bool can_execute(const Twine &Path) {
+  return !access(Path, AccessMode::Execute) ||
+         !access(Path + ".exe", AccessMode::Execute);
+}
+
 bool equivalent(file_status A, file_status B) {
   assert(status_known(A) && status_known(B));
   return A.FileIndexHigh      == B.FileIndexHigh &&