summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-10-14 15:46:30 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-10-14 15:46:30 (GMT)
commitef8385744b03068f53dc2710c53d160d05e7cf2a (patch)
tree754c829d031cd5bb8859f7ce4659257cadea26be /Source/cmSystemTools.cxx
parent78e8f12b86e7e4d21c8af1463a166341ba7398e7 (diff)
downloadCMake-ef8385744b03068f53dc2710c53d160d05e7cf2a.zip
CMake-ef8385744b03068f53dc2710c53d160d05e7cf2a.tar.gz
CMake-ef8385744b03068f53dc2710c53d160d05e7cf2a.tar.bz2
BUG: allow split string to know if it is separating a path
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 0fc6e34..d9f51f8 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1186,15 +1186,15 @@ bool cmSystemTools::CreateSymlink(const char* origName, const char* newName)
#endif
-std::vector<cmStdString> cmSystemTools::SplitString(const char* p, char sep)
+std::vector<cmStdString> cmSystemTools::SplitString(const char* p, char sep, bool isPath)
{
std::string path = p;
std::vector<cmStdString> paths;
- if(path[0] == '/')
+ if(isPath && path[0] == '/')
{
path.erase(path.begin());
+ paths.push_back("/");
}
- paths.push_back("/");
std::string::size_type pos1 = 0;
std::string::size_type pos2 = path.find(sep, pos1+1);
while(pos2 != std::string::npos)
@@ -1232,8 +1232,9 @@ std::string cmSystemTools::RelativePath(const char* local, const char* remote)
}
std::string relativePath; // result string
// split up both paths into arrays of strings using / as a separator
- std::vector<cmStdString> fileSplit = cmSystemTools::SplitString(local);
- std::vector<cmStdString> relativeSplit = cmSystemTools::SplitString(remote);
+ std::string localString = local;
+ std::vector<cmStdString> fileSplit = cmSystemTools::SplitString(local, '/', true);
+ std::vector<cmStdString> relativeSplit = cmSystemTools::SplitString(remote, '/', true);
std::vector<cmStdString> commonPath;
std::vector<cmStdString> finalPath;
// count up how many matching directory names there are from the start