summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-12-04 14:59:04 (GMT)
committerBrad King <brad.king@kitware.com>2015-12-04 14:59:04 (GMT)
commit306e2016bb3e285fcfb58e0f17657dc228b67812 (patch)
tree0126fcdfd5c7cfe2d16fe7a362f65a06a6a9860e /Source/kwsys/SystemTools.cxx
parente069aa05c6a0d8e89a677fa4f00d33432191eeaa (diff)
parentd5d90f5ec8792fafbe754e2c943825267f7aaff1 (diff)
downloadCMake-306e2016bb3e285fcfb58e0f17657dc228b67812.zip
CMake-306e2016bb3e285fcfb58e0f17657dc228b67812.tar.gz
CMake-306e2016bb3e285fcfb58e0f17657dc228b67812.tar.bz2
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx26
1 files changed, 9 insertions, 17 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 37fe421..82087f0 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2402,8 +2402,7 @@ bool SystemTools::CopyFileAlways(const std::string& source, const std::string& d
// name as the source in that directory.
std::string destination_dir;
- if(SystemTools::FileExists(destination) &&
- SystemTools::FileIsDirectory(destination))
+ if(SystemTools::FileIsDirectory(destination))
{
destination_dir = real_destination;
SystemTools::ConvertToUnixSlashes(real_destination);
@@ -2969,19 +2968,14 @@ std::string SystemTools::FindProgram(
const std::vector<std::string>& userPaths,
bool no_system_path)
{
- std::vector<std::string> extensions;
std::string tryPath;
#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
- bool hasExtension = false;
+ std::vector<std::string> extensions;
// check to see if the name already has a .xxx at
// the end of it
- if(name.size() > 3 && name[name.size()-4] == '.')
- {
- hasExtension = true;
- }
// on windows try .com then .exe
- if(!hasExtension)
+ if(name.size() <= 3 || name[name.size()-4] != '.')
{
extensions.push_back(".com");
extensions.push_back(".exe");
@@ -2992,8 +2986,7 @@ std::string SystemTools::FindProgram(
{
tryPath = name;
tryPath += *i;
- if(SystemTools::FileExists(tryPath) &&
- !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(tryPath, true))
{
return SystemTools::CollapseFullPath(tryPath);
}
@@ -3002,11 +2995,9 @@ std::string SystemTools::FindProgram(
#endif
// now try just the name
- tryPath = name;
- if(SystemTools::FileExists(tryPath) &&
- !SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileExists(name, true))
{
- return SystemTools::CollapseFullPath(tryPath);
+ return SystemTools::CollapseFullPath(name);
}
// now construct the path
std::vector<std::string> path;
@@ -3043,6 +3034,7 @@ std::string SystemTools::FindProgram(
// Remove double quotes from the path on windows
SystemTools::ReplaceString(*p, "\"", "");
#endif
+#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
// first try with extensions
for(std::vector<std::string>::iterator ext
= extensions.begin(); ext != extensions.end(); ++ext)
@@ -3055,6 +3047,7 @@ std::string SystemTools::FindProgram(
return SystemTools::CollapseFullPath(tryPath);
}
}
+#endif
// now try it without them
tryPath = *p;
tryPath += name;
@@ -3133,8 +3126,7 @@ std::string SystemTools
tryPath = *p;
tryPath += name;
tryPath += ".framework";
- if(SystemTools::FileExists(tryPath)
- && SystemTools::FileIsDirectory(tryPath))
+ if(SystemTools::FileIsDirectory(tryPath))
{
return SystemTools::CollapseFullPath(tryPath);
}