[PATCH] D12711: ScanDirForExecutable on Windows fails to find executables with the "exe" extension in name

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 08:38:55 PDT 2015


rnk added a comment.

Seems pretty close. Do you need someone to commit this for you?


================
Comment at: lib/Support/Windows/Path.inc:310-311
@@ +309,4 @@
+  PathExts.push_back(".exe"); // FIXME: This must be in %PATHEXT%.
+  if (const char *PathExtEnv = std::getenv("PATHEXT"))
+    SplitString(PathExtEnv, PathExts, ";");
+
----------------
I think `can_execute` should really be tied to what `llvm::sys::ExecteAndWait` can run. `ExecuteAndWait` uses `CreateProcess`, which ignores PATHEXT, but does check for files ending in `.exe`. So, if possible, I would simplify this whole thing to:
  return !access(Path, AccessMode::Execute) || !access(Path + ".exe", AccessMode::Execute);


Repository:
  rL LLVM

http://reviews.llvm.org/D12711





More information about the llvm-commits mailing list