summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2017-09-14 12:42:54 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-14 12:44:25 (GMT)
commit38b8017fa6ca017867a1fab2c01b94c8d5bb15be (patch)
tree34006af22b93bcdca238b6e617196981b9ddd3de
parent37760743fc50d9ad864e8a83f0da75ab000c22ec (diff)
downloadCMake-38b8017fa6ca017867a1fab2c01b94c8d5bb15be.zip
CMake-38b8017fa6ca017867a1fab2c01b94c8d5bb15be.tar.gz
CMake-38b8017fa6ca017867a1fab2c01b94c8d5bb15be.tar.bz2
KWSys 2017-09-14 (d85b17e7)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit d85b17e7b4a9754dfb4c69906378c77626c16d24 (master). Upstream Shortlog ----------------- Brad King (1): c8cfe4e0 SystemTools: Drop SplitProgramFromArgs function
-rw-r--r--SystemTools.cxx60
-rw-r--r--SystemTools.hxx.in6
2 files changed, 0 insertions, 66 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 560c19c..0a22d63 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -4102,66 +4102,6 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
#endif
}
-void SystemTools::SplitProgramFromArgs(const std::string& path,
- std::string& program, std::string& args)
-{
- // see if this is a full path to a program
- // if so then set program to path and args to nothing
- if (SystemTools::FileExists(path)) {
- program = path;
- args = "";
- return;
- }
- // Try to find the program in the path, note the program
- // may have spaces in its name so we have to look for it
- std::vector<std::string> e;
- std::string findProg = SystemTools::FindProgram(path, e);
- if (!findProg.empty()) {
- program = findProg;
- args = "";
- return;
- }
-
- // Now try and peel off space separated chunks from the end of the string
- // so the largest path possible is found allowing for spaces in the path
- std::string dir = path;
- std::string::size_type spacePos = dir.rfind(' ');
- while (spacePos != std::string::npos) {
- std::string tryProg = dir.substr(0, spacePos);
- // See if the file exists
- if (SystemTools::FileExists(tryProg)) {
- program = tryProg;
- // remove trailing spaces from program
- std::string::size_type pos = program.size() - 1;
- while (program[pos] == ' ') {
- program.erase(pos);
- pos--;
- }
- args = dir.substr(spacePos, dir.size() - spacePos);
- return;
- }
- // Now try and find the program in the path
- findProg = SystemTools::FindProgram(tryProg, e);
- if (!findProg.empty()) {
- program = findProg;
- // remove trailing spaces from program
- std::string::size_type pos = program.size() - 1;
- while (program[pos] == ' ') {
- program.erase(pos);
- pos--;
- }
- args = dir.substr(spacePos, dir.size() - spacePos);
- return;
- }
- // move past the space for the next search
- spacePos--;
- spacePos = dir.rfind(' ', spacePos);
- }
-
- program = "";
- args = "";
-}
-
std::string SystemTools::GetCurrentDateTime(const char* format)
{
char buf[1024];
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in
index 1672e92..41a60d3 100644
--- a/SystemTools.hxx.in
+++ b/SystemTools.hxx.in
@@ -498,12 +498,6 @@ public:
static std::string GetFilenameName(const std::string&);
/**
- * Split a program from its arguments and handle spaces in the paths
- */
- static void SplitProgramFromArgs(const std::string& path,
- std::string& program, std::string& args);
-
- /**
* Return longest file extension of a full filename (dot included)
*/
static std::string GetFilenameExtension(const std::string&);