diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-07-11 16:12:13 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-07-11 16:12:13 (GMT) |
commit | 189a9db9b632a95aa8b9887d07e820dd480bf60d (patch) | |
tree | cee5f4814e4a5eb9051ecc7260a8dc89b646591e | |
parent | d4edafe71754ccdbec8206cf8ba6c22580276bec (diff) | |
download | CMake-189a9db9b632a95aa8b9887d07e820dd480bf60d.zip CMake-189a9db9b632a95aa8b9887d07e820dd480bf60d.tar.gz CMake-189a9db9b632a95aa8b9887d07e820dd480bf60d.tar.bz2 |
BUG: make sure find program does not find directories
-rw-r--r-- | Source/cmSystemTools.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index b7e7cf1..ee986b6 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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()); } |