mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
fs: Make fs::get_dir_size able to report an error
This commit is contained in:
parent
569e1c2df6
commit
0d4f8ca234
3 changed files with 67 additions and 18 deletions
|
@ -1639,7 +1639,14 @@ u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment)
|
|||
{
|
||||
u64 result = 0;
|
||||
|
||||
for (const auto& entry : dir(path))
|
||||
const auto root_dir = dir(path);
|
||||
|
||||
if (!root_dir)
|
||||
{
|
||||
return static_cast<u64>(umax);
|
||||
}
|
||||
|
||||
for (const auto& entry : root_dir)
|
||||
{
|
||||
if (entry.name == "." || entry.name == "..")
|
||||
{
|
||||
|
@ -1653,7 +1660,14 @@ u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment)
|
|||
|
||||
if (entry.is_directory == true)
|
||||
{
|
||||
result += get_dir_size(path_append(path, entry.name), rounding_alignment);
|
||||
const u64 size = get_dir_size(path_append(path, entry.name), rounding_alignment);
|
||||
|
||||
if (size == umax)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
result += size;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue