bump simplecpp

This commit is contained in:
Daniel Marjamäki 2016-07-24 11:36:02 +02:00
parent fee2f46efe
commit 161bb50e0c
1 changed files with 8 additions and 2 deletions

View File

@ -1203,9 +1203,15 @@ std::string simplifyPath(std::string path) {
} }
// remove "xyz/../" // remove "xyz/../"
while ((pos = path.find("/../")) != std::string::npos) { pos = 1U;
while ((pos = path.find("/../", pos)) != std::string::npos) {
const std::string::size_type pos1 = path.rfind("/", pos - 1U); const std::string::size_type pos1 = path.rfind("/", pos - 1U);
path.erase(pos1,pos-pos1+3); if (pos1 == std::string::npos)
pos++;
else {
path.erase(pos1,pos-pos1+3);
pos = std::min((std::string::size_type)1, pos1);
}
} }
return path; return path;