mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 03:40:24 +00:00
Remove redundant startsWith function
This commit is contained in:
parent
225946b92b
commit
3363616f56
1 changed files with 1 additions and 9 deletions
|
@ -70,21 +70,13 @@ namespace VFS
|
||||||
return found->second->getPath();
|
return found->second->getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
bool startsWith(std::string_view text, std::string_view start)
|
|
||||||
{
|
|
||||||
return text.rfind(start, 0) == 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Manager::RecursiveDirectoryRange Manager::getRecursiveDirectoryIterator(std::string_view path) const
|
Manager::RecursiveDirectoryRange Manager::getRecursiveDirectoryIterator(std::string_view path) const
|
||||||
{
|
{
|
||||||
if (path.empty())
|
if (path.empty())
|
||||||
return { mIndex.begin(), mIndex.end() };
|
return { mIndex.begin(), mIndex.end() };
|
||||||
std::string normalized = Path::normalizeFilename(path);
|
std::string normalized = Path::normalizeFilename(path);
|
||||||
const auto it = mIndex.lower_bound(normalized);
|
const auto it = mIndex.lower_bound(normalized);
|
||||||
if (it == mIndex.end() || !startsWith(it->first, normalized))
|
if (it == mIndex.end() || !it->first.starts_with(normalized))
|
||||||
return { it, it };
|
return { it, it };
|
||||||
++normalized.back();
|
++normalized.back();
|
||||||
return { it, mIndex.lower_bound(normalized) };
|
return { it, mIndex.lower_bound(normalized) };
|
||||||
|
|
Loading…
Reference in a new issue