This commit is contained in:
xiedeyantu 2022-10-24 11:52:20 +08:00
parent 330777a0cc
commit 61563d4f19

View File

@ -44,19 +44,22 @@ static void calculateTotalSizeOnDiskImpl(const DiskPtr & disk, const String & fr
{ {
tryLogCurrentException(__PRETTY_FUNCTION__); tryLogCurrentException(__PRETTY_FUNCTION__);
} }
return;
} }
std::vector<std::string> files; else
try
{ {
disk->listFiles(from, files); DirectoryIteratorPtr it;
try
{
it = disk->iterateDirectory(from);
}
catch (...)
{
tryLogCurrentException(__PRETTY_FUNCTION__);
}
for (; it->isValid(); it->next())
calculateTotalSizeOnDiskImpl(disk, fs::path(from) / it->name(), total_size);
} }
catch (...)
{
tryLogCurrentException(__PRETTY_FUNCTION__);
}
for (const auto & file : files)
calculateTotalSizeOnDiskImpl(disk, fs::path(from) / file, total_size);
} }
static UInt64 calculateTotalSizeOnDisk(const DiskPtr & disk, const String & from) static UInt64 calculateTotalSizeOnDisk(const DiskPtr & disk, const String & from)