mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 12:40:06 +00:00
BUG: make sure find program does not find directories
This commit is contained in:
parent
d4edafe717
commit
189a9db9b6
@ -840,13 +840,15 @@ std::string cmSystemTools::FindProgram(const char* name,
|
||||
const std::vector<std::string>& userPaths)
|
||||
{
|
||||
// See if the executable exists as written.
|
||||
if(cmSystemTools::FileExists(name))
|
||||
if(cmSystemTools::FileExists(name) &&
|
||||
!cmSystemTools::FileIsDirectory(name))
|
||||
{
|
||||
return cmSystemTools::CollapseFullPath(name);
|
||||
}
|
||||
std::string tryPath = name;
|
||||
tryPath += cmSystemTools::GetExecutableExtension();
|
||||
if(cmSystemTools::FileExists(tryPath.c_str()))
|
||||
if(cmSystemTools::FileExists(tryPath.c_str()) &&
|
||||
!cmSystemTools::FileIsDirectory(tryPath.c_str()))
|
||||
{
|
||||
return cmSystemTools::CollapseFullPath(tryPath.c_str());
|
||||
}
|
||||
@ -861,12 +863,14 @@ std::string cmSystemTools::FindProgram(const char* name,
|
||||
tryPath = *p;
|
||||
tryPath += "/";
|
||||
tryPath += name;
|
||||
if(cmSystemTools::FileExists(tryPath.c_str()))
|
||||
if(cmSystemTools::FileExists(tryPath.c_str()) &&
|
||||
!cmSystemTools::FileIsDirectory(tryPath.c_str()))
|
||||
{
|
||||
return cmSystemTools::CollapseFullPath(tryPath.c_str());
|
||||
}
|
||||
tryPath += cmSystemTools::GetExecutableExtension();
|
||||
if(cmSystemTools::FileExists(tryPath.c_str()))
|
||||
if(cmSystemTools::FileExists(tryPath.c_str()) &&
|
||||
!cmSystemTools::FileIsDirectory(tryPath.c_str()))
|
||||
{
|
||||
return cmSystemTools::CollapseFullPath(tryPath.c_str());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user