summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-12-01 13:46:55 (GMT)
committerBrad King <brad.king@kitware.com>2015-12-01 13:46:55 (GMT)
commitfe05ad975292a2ff57a66746f1aa3870217f1ddd (patch)
tree6746522ac4c8c03e21384882a8232a3d9114e861 /Source/kwsys/SystemTools.cxx
parent2218962dbdc7f552a076978a0393433091aa35c4 (diff)
parente25f294a0e0aa03da4516d0baa488ad02cece089 (diff)
downloadCMake-fe05ad975292a2ff57a66746f1aa3870217f1ddd.zip
CMake-fe05ad975292a2ff57a66746f1aa3870217f1ddd.tar.gz
CMake-fe05ad975292a2ff57a66746f1aa3870217f1ddd.tar.bz2
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx53
1 files changed, 23 insertions, 30 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index da34eb9..37fe421 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2970,6 +2970,8 @@ std::string SystemTools::FindProgram(
bool no_system_path)
{
std::vector<std::string> extensions;
+ std::string tryPath;
+
#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
bool hasExtension = false;
// check to see if the name already has a .xxx at
@@ -2983,22 +2985,22 @@ std::string SystemTools::FindProgram(
{
extensions.push_back(".com");
extensions.push_back(".exe");
- }
-#endif
- std::string tryPath;
- // first try with extensions if the os supports them
- for(std::vector<std::string>::iterator i =
- extensions.begin(); i != extensions.end(); ++i)
- {
- tryPath = name;
- tryPath += *i;
- if(SystemTools::FileExists(tryPath) &&
- !SystemTools::FileIsDirectory(tryPath))
+ // first try with extensions if the os supports them
+ for(std::vector<std::string>::iterator i =
+ extensions.begin(); i != extensions.end(); ++i)
{
- return SystemTools::CollapseFullPath(tryPath);
+ tryPath = name;
+ tryPath += *i;
+ if(SystemTools::FileExists(tryPath) &&
+ !SystemTools::FileIsDirectory(tryPath))
+ {
+ return SystemTools::CollapseFullPath(tryPath);
+ }
}
}
+#endif
+
// now try just the name
tryPath = name;
if(SystemTools::FileExists(tryPath) &&
@@ -3048,8 +3050,7 @@ std::string SystemTools::FindProgram(
tryPath = *p;
tryPath += name;
tryPath += *ext;
- if(SystemTools::FileExists(tryPath) &&
- !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3057,8 +3058,7 @@ std::string SystemTools::FindProgram(
// now try it without them
tryPath = *p;
tryPath += name;
- if(SystemTools::FileExists(tryPath) &&
- !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3097,8 +3097,7 @@ std::string SystemTools
const std::vector<std::string>& userPaths)
{
// See if the executable exists as written.
- if(SystemTools::FileExists(name) &&
- !SystemTools::FileIsDirectory(name))
+ if(SystemTools::FileExists(name, true))
{
return SystemTools::CollapseFullPath(name);
}
@@ -3144,8 +3143,7 @@ std::string SystemTools
tryPath = *p;
tryPath += name;
tryPath += ".lib";
- if(SystemTools::FileExists(tryPath)
- && !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3154,8 +3152,7 @@ std::string SystemTools
tryPath += "lib";
tryPath += name;
tryPath += ".so";
- if(SystemTools::FileExists(tryPath)
- && !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3163,8 +3160,7 @@ std::string SystemTools
tryPath += "lib";
tryPath += name;
tryPath += ".a";
- if(SystemTools::FileExists(tryPath)
- && !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3172,8 +3168,7 @@ std::string SystemTools
tryPath += "lib";
tryPath += name;
tryPath += ".sl";
- if(SystemTools::FileExists(tryPath)
- && !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3181,8 +3176,7 @@ std::string SystemTools
tryPath += "lib";
tryPath += name;
tryPath += ".dylib";
- if(SystemTools::FileExists(tryPath)
- && !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3190,8 +3184,7 @@ std::string SystemTools
tryPath += "lib";
tryPath += name;
tryPath += ".dll";
- if(SystemTools::FileExists(tryPath)
- && !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}