Use path::is_child instead of custom code

This commit is contained in:
Allan Odgaard
2013-02-25 15:25:17 +01:00
parent 6d6c3e4de6
commit c4323efbb7
2 changed files with 3 additions and 3 deletions

View File

@@ -2273,7 +2273,7 @@ static NSUInteger DisableSessionSavingCount = 0;
std::string const projectPath = to_s(candidate.projectPath);
iterate(parent, parents)
{
if(parent->find(projectPath) == 0 && (parent->size() == projectPath.size() || (*parent)[projectPath.size()] == '/'))
if(path::is_child(*parent, projectPath))
candidates.insert(std::make_pair(parent->size() - projectPath.size(), candidate));
}
}

View File

@@ -47,7 +47,7 @@ _Iter prune_path_parents (_Iter it, _Iter last)
std::reverse(it, last);
for(std::string child = NULL_STR; it != last; child = *it++)
{
if(child.size() <= it->size() || child.at(it->size()) != '/' || child.find(*it) != 0)
if(!path::is_child(child, *it))
*out++ = *it;
}
return out;
@@ -60,7 +60,7 @@ _Iter prune_path_children (_Iter it, _Iter last)
std::sort(it, last);
for(std::string parent = NULL_STR; it != last; ++it)
{
if(it->size() <= parent.size() || it->at(parent.size()) != '/' || it->find(parent) != 0)
if(!path::is_child(*it, parent))
*out++ = parent = *it;
}
return out;