Commit 986519af authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King
Browse files

SystemTools: handle splitting a string starting with the separator

If a string started with the separator, the first component would have
the separator included in it.
parent 09942f51
...@@ -1904,7 +1904,7 @@ std::vector<std::string> SystemTools::SplitString(const std::string& p, ...@@ -1904,7 +1904,7 @@ std::vector<std::string> SystemTools::SplitString(const std::string& p,
paths.emplace_back("/"); paths.emplace_back("/");
} }
std::string::size_type pos1 = 0; std::string::size_type pos1 = 0;
std::string::size_type pos2 = path.find(sep, pos1 + 1); std::string::size_type pos2 = path.find(sep, pos1);
while (pos2 != std::string::npos) { while (pos2 != std::string::npos) {
paths.push_back(path.substr(pos1, pos2 - pos1)); paths.push_back(path.substr(pos1, pos2 - pos1));
pos1 = pos2 + 1; pos1 = pos2 + 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment