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

Oleg Ranevskyy via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 12:42:18 PDT 2015

iid_iunknown marked an inline comment as done.
iid_iunknown added a comment.

In http://reviews.llvm.org/D12711#242494, @rnk wrote:

> 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, ";");
rnk wrote:
> 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);
Yes, other extensions are not that common for Windows executables. Anyway, it would be fine for my case.
Does it mean findProgramByName may be simplified in the same way?



More information about the llvm-commits mailing list