diff options
Diffstat (limited to 'src/common/file_util.cpp')
| -rw-r--r-- | src/common/file_util.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 543adbffb..47ac8368e 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -396,12 +396,12 @@ bool CreateEmptyFile(const std::string& filename) { | |||
| 396 | return true; | 396 | return true; |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, | 399 | bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory, |
| 400 | DirectoryEntryCallable callback) { | 400 | DirectoryEntryCallable callback) { |
| 401 | LOG_TRACE(Common_Filesystem, "directory {}", directory); | 401 | LOG_TRACE(Common_Filesystem, "directory {}", directory); |
| 402 | 402 | ||
| 403 | // How many files + directories we found | 403 | // How many files + directories we found |
| 404 | unsigned found_entries = 0; | 404 | u64 found_entries = 0; |
| 405 | 405 | ||
| 406 | // Save the status of callback function | 406 | // Save the status of callback function |
| 407 | bool callback_error = false; | 407 | bool callback_error = false; |
| @@ -431,7 +431,7 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directo | |||
| 431 | if (virtual_name == "." || virtual_name == "..") | 431 | if (virtual_name == "." || virtual_name == "..") |
| 432 | continue; | 432 | continue; |
| 433 | 433 | ||
| 434 | unsigned ret_entries = 0; | 434 | u64 ret_entries = 0; |
| 435 | if (!callback(&ret_entries, directory, virtual_name)) { | 435 | if (!callback(&ret_entries, directory, virtual_name)) { |
| 436 | callback_error = true; | 436 | callback_error = true; |
| 437 | break; | 437 | break; |
| @@ -455,9 +455,9 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directo | |||
| 455 | return true; | 455 | return true; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | 458 | u64 ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, |
| 459 | unsigned int recursion) { | 459 | unsigned int recursion) { |
| 460 | const auto callback = [recursion, &parent_entry](unsigned* num_entries_out, | 460 | const auto callback = [recursion, &parent_entry](u64* num_entries_out, |
| 461 | const std::string& directory, | 461 | const std::string& directory, |
| 462 | const std::string& virtual_name) -> bool { | 462 | const std::string& virtual_name) -> bool { |
| 463 | FSTEntry entry; | 463 | FSTEntry entry; |
| @@ -469,7 +469,7 @@ unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | |||
| 469 | // is a directory, lets go inside if we didn't recurse to often | 469 | // is a directory, lets go inside if we didn't recurse to often |
| 470 | if (recursion > 0) { | 470 | if (recursion > 0) { |
| 471 | entry.size = ScanDirectoryTree(entry.physicalName, entry, recursion - 1); | 471 | entry.size = ScanDirectoryTree(entry.physicalName, entry, recursion - 1); |
| 472 | *num_entries_out += (int)entry.size; | 472 | *num_entries_out += entry.size; |
| 473 | } else { | 473 | } else { |
| 474 | entry.size = 0; | 474 | entry.size = 0; |
| 475 | } | 475 | } |
| @@ -484,12 +484,12 @@ unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | |||
| 484 | return true; | 484 | return true; |
| 485 | }; | 485 | }; |
| 486 | 486 | ||
| 487 | unsigned num_entries; | 487 | u64 num_entries; |
| 488 | return ForeachDirectoryEntry(&num_entries, directory, callback) ? num_entries : 0; | 488 | return ForeachDirectoryEntry(&num_entries, directory, callback) ? num_entries : 0; |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { | 491 | bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { |
| 492 | const auto callback = [recursion](unsigned* num_entries_out, const std::string& directory, | 492 | const auto callback = [recursion](u64* num_entries_out, const std::string& directory, |
| 493 | const std::string& virtual_name) -> bool { | 493 | const std::string& virtual_name) -> bool { |
| 494 | std::string new_path = directory + DIR_SEP_CHR + virtual_name; | 494 | std::string new_path = directory + DIR_SEP_CHR + virtual_name; |
| 495 | 495 | ||