mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-01 15:11:31 +00:00
Use is_directory member function
To reduce the number of syscalls.
This commit is contained in:
parent
56596e7589
commit
c2ac1ce046
1 changed files with 4 additions and 4 deletions
|
@ -24,11 +24,11 @@ namespace VFS
|
||||||
|
|
||||||
for (auto it = std::filesystem::begin(iterator), end = std::filesystem::end(iterator); it != end;)
|
for (auto it = std::filesystem::begin(iterator), end = std::filesystem::end(iterator); it != end;)
|
||||||
{
|
{
|
||||||
const auto& i = *it;
|
const std::filesystem::directory_entry& entry = *it;
|
||||||
|
|
||||||
if (!std::filesystem::is_directory(i))
|
if (!entry.is_directory())
|
||||||
{
|
{
|
||||||
const std::filesystem::path& filePath = i.path();
|
const std::filesystem::path& filePath = entry.path();
|
||||||
const std::string proper = Files::pathToUnicodeString(filePath);
|
const std::string proper = Files::pathToUnicodeString(filePath);
|
||||||
VFS::Path::Normalized searchable(std::string_view{ proper }.substr(prefix));
|
VFS::Path::Normalized searchable(std::string_view{ proper }.substr(prefix));
|
||||||
FileSystemArchiveFile file(filePath);
|
FileSystemArchiveFile file(filePath);
|
||||||
|
@ -43,7 +43,7 @@ namespace VFS
|
||||||
// Exception thrown by the operator++ may not contain the context of the error like what exact path caused
|
// Exception thrown by the operator++ may not contain the context of the error like what exact path caused
|
||||||
// the problem which makes it hard to understand what's going on when iteration happens over a directory
|
// the problem which makes it hard to understand what's going on when iteration happens over a directory
|
||||||
// with thousands of files and subdirectories.
|
// with thousands of files and subdirectories.
|
||||||
const std::filesystem::path prevPath = i.path();
|
const std::filesystem::path prevPath = entry.path();
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
it.increment(ec);
|
it.increment(ec);
|
||||||
if (ec != std::error_code())
|
if (ec != std::error_code())
|
||||||
|
|
Loading…
Reference in a new issue