Commit 41700ca4 authored by Brad King's avatar Brad King
Browse files

SystemTools: Fix FileIsExecutable on Windows

Since commit 66724af8 (SystemTools: Teach FindProgram to find
non-readable programs, 2020-04-04), `FindProgram` uses the new
`FileIsExecutable` method.  On Windows this changed the check
from `GetFileAttributesW` to `_waccess`, but the latter returns
success even for Windows Store stubs like

  %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\python.exe

Since the goal of the original change was to fix executable
permissions checks on UNIX-like platforms, simply restore the
old check code on Windows.
parent caff9c3b
......@@ -3010,7 +3010,11 @@ bool SystemTools::FileIsDirectory(const std::string& inName)
bool SystemTools::FileIsExecutable(const std::string& name)
{
#if defined(_WIN32)
return SystemTools::FileExists(name, true);
#else
return !FileIsDirectory(name) && TestFileAccess(name, TEST_FILE_EXECUTE);
#endif
}
bool SystemTools::FileIsSymlink(const std::string& name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment