mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-31 18:15:01 +00:00
Return Path::Normalized from RecursiveDirectoryIterator
This commit is contained in:
parent
9279138fb0
commit
70061329a1
@ -113,9 +113,9 @@ void readVFS(std::unique_ptr<VFS::Archive>&& archive, const std::filesystem::pat
|
||||
|
||||
for (const auto& name : vfs.getRecursiveDirectoryIterator(""))
|
||||
{
|
||||
if (isNIF(name))
|
||||
if (isNIF(name.value()))
|
||||
{
|
||||
readNIF(archivePath, name, &vfs, quiet);
|
||||
readNIF(archivePath, name.value(), &vfs, quiet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,18 +30,18 @@ void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char* const* e
|
||||
|
||||
for (const auto& filepath : vfs->getRecursiveDirectoryIterator(""))
|
||||
{
|
||||
if (filepath.size() < baseSize + 1 || filepath.substr(0, baseSize) != mBaseDirectory
|
||||
|| (filepath[baseSize] != '/' && filepath[baseSize] != '\\'))
|
||||
const std::string_view view = filepath.view();
|
||||
if (view.size() < baseSize + 1 || !view.starts_with(mBaseDirectory) || view[baseSize] != '/')
|
||||
continue;
|
||||
|
||||
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;
|
||||
|
||||
std::string extension = filepath.substr(extensionIndex + 1);
|
||||
std::string_view extension = view.substr(extensionIndex + 1);
|
||||
|
||||
int i = 0;
|
||||
|
||||
@ -53,10 +53,9 @@ void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char* const* e
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string file = filepath.substr(baseSize + 1);
|
||||
std::string file(view.substr(baseSize + 1));
|
||||
mFiles.push_back(file);
|
||||
std::replace(file.begin(), file.end(), '\\', '/');
|
||||
mIndex.insert(std::make_pair(Misc::StringUtils::lowerCase(file), static_cast<int>(mFiles.size()) - 1));
|
||||
mIndex.emplace(std::move(file), static_cast<int>(mFiles.size()) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,9 @@ namespace VFS
|
||||
{
|
||||
}
|
||||
|
||||
const std::string& operator*() const { return mIt->first.value(); }
|
||||
const Path::Normalized& operator*() const { return mIt->first; }
|
||||
|
||||
const std::string* operator->() const { return &mIt->first.value(); }
|
||||
const Path::Normalized* operator->() const { return &mIt->first; }
|
||||
|
||||
RecursiveDirectoryIterator& operator++()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user