fscache: removePrefix(): use starts_with()

This commit is contained in:
Albert S. 2021-10-19 15:07:10 +02:00
父節點 873401694e
當前提交 b41a5f4e5b
共有 1 個文件被更改,包括 1 次插入1 次删除

2
cache/fscache.cpp vendored
查看文件

@ -46,7 +46,7 @@ void FsCache::removePrefix(std::string_view prefix)
// TODO: lock dir
for(auto &entry : std::filesystem::directory_iterator(std::filesystem::path{this->path}))
{
if(static_cast<std::string>(entry.path().filename()).find(prefix) == 0)
if(std::string_view(entry.path().filename().c_str()).starts_with(prefix) == 0)
{
std::filesystem::remove_all(entry);
}