diff options
Diffstat (limited to 'src/common/file_util.cpp')
| -rw-r--r-- | src/common/file_util.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 819ffd6ff..a427372c9 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -386,12 +386,12 @@ bool CreateEmptyFile(const std::string& filename) { | |||
| 386 | return true; | 386 | return true; |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, | 389 | bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory, |
| 390 | DirectoryEntryCallable callback) { | 390 | DirectoryEntryCallable callback) { |
| 391 | LOG_TRACE(Common_Filesystem, "directory {}", directory); | 391 | LOG_TRACE(Common_Filesystem, "directory {}", directory); |
| 392 | 392 | ||
| 393 | // How many files + directories we found | 393 | // How many files + directories we found |
| 394 | unsigned found_entries = 0; | 394 | u64 found_entries = 0; |
| 395 | 395 | ||
| 396 | // Save the status of callback function | 396 | // Save the status of callback function |
| 397 | bool callback_error = false; | 397 | bool callback_error = false; |
| @@ -421,7 +421,7 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directo | |||
| 421 | if (virtual_name == "." || virtual_name == "..") | 421 | if (virtual_name == "." || virtual_name == "..") |
| 422 | continue; | 422 | continue; |
| 423 | 423 | ||
| 424 | unsigned ret_entries = 0; | 424 | u64 ret_entries = 0; |
| 425 | if (!callback(&ret_entries, directory, virtual_name)) { | 425 | if (!callback(&ret_entries, directory, virtual_name)) { |
| 426 | callback_error = true; | 426 | callback_error = true; |
| 427 | break; | 427 | break; |
| @@ -445,9 +445,9 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directo | |||
| 445 | return true; | 445 | return true; |
| 446 | } | 446 | } |
| 447 | 447 | ||
| 448 | unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | 448 | u64 ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, |
| 449 | unsigned int recursion) { | 449 | unsigned int recursion) { |
| 450 | const auto callback = [recursion, &parent_entry](unsigned* num_entries_out, | 450 | const auto callback = [recursion, &parent_entry](u64* num_entries_out, |
| 451 | const std::string& directory, | 451 | const std::string& directory, |
| 452 | const std::string& virtual_name) -> bool { | 452 | const std::string& virtual_name) -> bool { |
| 453 | FSTEntry entry; | 453 | FSTEntry entry; |
| @@ -459,7 +459,7 @@ unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | |||
| 459 | // is a directory, lets go inside if we didn't recurse to often | 459 | // is a directory, lets go inside if we didn't recurse to often |
| 460 | if (recursion > 0) { | 460 | if (recursion > 0) { |
| 461 | entry.size = ScanDirectoryTree(entry.physicalName, entry, recursion - 1); | 461 | entry.size = ScanDirectoryTree(entry.physicalName, entry, recursion - 1); |
| 462 | *num_entries_out += (int)entry.size; | 462 | *num_entries_out += entry.size; |
| 463 | } else { | 463 | } else { |
| 464 | entry.size = 0; | 464 | entry.size = 0; |
| 465 | } | 465 | } |
| @@ -470,16 +470,16 @@ unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, | |||
| 470 | (*num_entries_out)++; | 470 | (*num_entries_out)++; |
| 471 | 471 | ||
| 472 | // Push into the tree | 472 | // Push into the tree |
| 473 | parent_entry.children.push_back(entry); | 473 | parent_entry.children.push_back(std::move(entry)); |
| 474 | return true; | 474 | return true; |
| 475 | }; | 475 | }; |
| 476 | 476 | ||
| 477 | unsigned num_entries; | 477 | u64 num_entries; |
| 478 | return ForeachDirectoryEntry(&num_entries, directory, callback) ? num_entries : 0; | 478 | return ForeachDirectoryEntry(&num_entries, directory, callback) ? num_entries : 0; |
| 479 | } | 479 | } |
| 480 | 480 | ||
| 481 | bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { | 481 | bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { |
| 482 | const auto callback = [recursion](unsigned* num_entries_out, const std::string& directory, | 482 | const auto callback = [recursion](u64* num_entries_out, const std::string& directory, |
| 483 | const std::string& virtual_name) -> bool { | 483 | const std::string& virtual_name) -> bool { |
| 484 | std::string new_path = directory + DIR_SEP_CHR + virtual_name; | 484 | std::string new_path = directory + DIR_SEP_CHR + virtual_name; |
| 485 | 485 | ||