|
|
@ -30,18 +30,18 @@ void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char* const* e
|
|
|
|
|
|
|
|
|
|
|
|
for (const auto& filepath : vfs->getRecursiveDirectoryIterator(""))
|
|
|
|
for (const auto& filepath : vfs->getRecursiveDirectoryIterator(""))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (filepath.size() < baseSize + 1 || filepath.substr(0, baseSize) != mBaseDirectory
|
|
|
|
const std::string_view view = filepath.view();
|
|
|
|
|| (filepath[baseSize] != '/' && filepath[baseSize] != '\\'))
|
|
|
|
if (view.size() < baseSize + 1 || !view.starts_with(mBaseDirectory) || view[baseSize] != '/')
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (extensions)
|
|
|
|
if (extensions)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string::size_type extensionIndex = filepath.find_last_of('.');
|
|
|
|
const auto extensionIndex = view.find_last_of('.');
|
|
|
|
|
|
|
|
|
|
|
|
if (extensionIndex == std::string::npos)
|
|
|
|
if (extensionIndex == std::string_view::npos)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
std::string extension = filepath.substr(extensionIndex + 1);
|
|
|
|
std::string_view extension = view.substr(extensionIndex + 1);
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -53,10 +53,9 @@ void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char* const* e
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string file = filepath.substr(baseSize + 1);
|
|
|
|
std::string file(view.substr(baseSize + 1));
|
|
|
|
mFiles.push_back(file);
|
|
|
|
mFiles.push_back(file);
|
|
|
|
std::replace(file.begin(), file.end(), '\\', '/');
|
|
|
|
mIndex.emplace(std::move(file), static_cast<int>(mFiles.size()) - 1);
|
|
|
|
mIndex.insert(std::make_pair(Misc::StringUtils::lowerCase(file), static_cast<int>(mFiles.size()) - 1));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|