Add option to get file size of all opened archives
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user