diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-12-26 20:00:27 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-12-26 20:00:27 (GMT) |
commit | 32accc160762ca80f1138d4e9c710d9edb72479c (patch) | |
tree | 833c2501fd16b44dfd418e36f65ae3a46a854d45 | |
parent | b5035770bc15cf8ddaefe87ee2dc291cd29e07da (diff) | |
download | CMake-32accc160762ca80f1138d4e9c710d9edb72479c.zip CMake-32accc160762ca80f1138d4e9c710d9edb72479c.tar.gz CMake-32accc160762ca80f1138d4e9c710d9edb72479c.tar.bz2 |
BUG: For consistency, use cmStdString. Also, there was a bug in SplitString which make it lose the first character.
-rw-r--r-- | Source/cmSystemTools.cxx | 14 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 5c4f307..9716dc6 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1066,19 +1066,19 @@ bool cmSystemTools::CreateSymlink(const char* origName, const char* newName) #endif -std::vector<std::string> cmSystemTools::SplitString(const char* p, char sep) +std::vector<cmStdString> cmSystemTools::SplitString(const char* p, char sep) { std::string path = p; - std::vector<std::string> paths; + std::vector<cmStdString> paths; std::string::size_type pos1 = 0; std::string::size_type pos2 = path.find(sep, pos1+1); while(pos2 != std::string::npos) { - paths.push_back(path.substr(pos1+1, pos2-pos1-1)); - pos1 = pos2; + paths.push_back(path.substr(pos1, pos2-pos1)); + pos1 = pos2+1; pos2 = path.find(sep, pos1+1); } - paths.push_back(path.substr(pos1+1, pos2-pos1-1)); + paths.push_back(path.substr(pos1, pos2-pos1)); return paths; } @@ -1104,8 +1104,8 @@ 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<std::string> fileSplit = cmSystemTools::SplitString(local); - std::vector<std::string> relativeSplit = cmSystemTools::SplitString(remote); + std::vector<cmStdString> fileSplit = cmSystemTools::SplitString(local); + std::vector<cmStdString> relativeSplit = cmSystemTools::SplitString(remote); // count up how many mathing directory names there are from the start unsigned int sameCount = 0; while(sameCount < fileSplit.size()-1 && sameCount < relativeSplit.size()-1 && diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 4aeaf18..939d178 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -249,7 +249,7 @@ public: ///! compute the relative path from local to remote static std::string RelativePath(const char* local, const char* remote); ///! split a path by separator into an array of strings, default is / - static std::vector<std::string> SplitString(const char* s, char separator = '/'); + static std::vector<cmStdString> SplitString(const char* s, char separator = '/'); private: static bool s_ForceUnixPaths; static bool s_RunCommandHideConsole; |