Add option to get file size of all opened archives

This commit is contained in:
Georg Hagen
2024-08-14 15:43:01 +02:00
parent a3a8409c73
commit c5dfbc41e0
3 changed files with 8 additions and 4 deletions

View File

@@ -101,7 +101,7 @@ namespace OpenVulkano
}
}
bool ArchiveReader::Open(const std::filesystem::path& dir, const std::string& fileNamePattern)
bool ArchiveReader::Open(const std::filesystem::path& dir, const std::string& fileNamePattern, size_t* outSize)
{
std::vector<std::string> files;
@@ -109,9 +109,13 @@ namespace OpenVulkano
for(const std::filesystem::directory_entry& dirEntry : std::filesystem::directory_iterator(dir))
{
std::string entryPath = dirEntry.path().string();
if (std::regex_match(entryPath, fileRegex))
if (!dirEntry.is_directory() && std::regex_match(entryPath, fileRegex))
{
files.push_back(std::move(entryPath));
if (outSize)
{
*outSize += dirEntry.file_size();
}
}
}