summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/file_util.cpp20
-rw-r--r--src/common/file_util.h8
-rw-r--r--src/core/file_sys/vfs_real.cpp6
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp2
-rw-r--r--src/yuzu/game_list.cpp2
5 files changed, 19 insertions, 19 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index d8163a4a8..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
399bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, 399bool 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
458unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, 458u64 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 }
@@ -480,16 +480,16 @@ unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry,
480 (*num_entries_out)++; 480 (*num_entries_out)++;
481 481
482 // Push into the tree 482 // Push into the tree
483 parent_entry.children.push_back(entry); 483 parent_entry.children.push_back(std::move(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
491bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) { 491bool 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
diff --git a/src/common/file_util.h b/src/common/file_util.h
index ff01bf0ff..090907c03 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -84,7 +84,7 @@ bool CreateEmptyFile(const std::string& filename);
84 * @return whether handling the entry succeeded 84 * @return whether handling the entry succeeded
85 */ 85 */
86using DirectoryEntryCallable = std::function<bool( 86using DirectoryEntryCallable = std::function<bool(
87 unsigned* num_entries_out, const std::string& directory, const std::string& virtual_name)>; 87 u64* num_entries_out, const std::string& directory, const std::string& virtual_name)>;
88 88
89/** 89/**
90 * Scans a directory, calling the callback for each file/directory contained within. 90 * Scans a directory, calling the callback for each file/directory contained within.
@@ -95,7 +95,7 @@ using DirectoryEntryCallable = std::function<bool(
95 * @param callback The callback which will be called for each entry 95 * @param callback The callback which will be called for each entry
96 * @return whether scanning the directory succeeded 96 * @return whether scanning the directory succeeded
97 */ 97 */
98bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directory, 98bool ForeachDirectoryEntry(u64* num_entries_out, const std::string& directory,
99 DirectoryEntryCallable callback); 99 DirectoryEntryCallable callback);
100 100
101/** 101/**
@@ -105,8 +105,8 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string& directo
105 * @param recursion Number of children directories to read before giving up. 105 * @param recursion Number of children directories to read before giving up.
106 * @return the total number of files/directories found 106 * @return the total number of files/directories found
107 */ 107 */
108unsigned ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry, 108u64 ScanDirectoryTree(const std::string& directory, FSTEntry& parent_entry,
109 unsigned int recursion = 0); 109 unsigned int recursion = 0);
110 110
111// deletes the given directory and anything under it. Returns true on success. 111// deletes the given directory and anything under it. Returns true on success.
112bool DeleteDirRecursively(const std::string& directory, unsigned int recursion = 256); 112bool DeleteDirRecursively(const std::string& directory, unsigned int recursion = 256);
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index f27fb1f2a..27fd464ae 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -92,13 +92,13 @@ RealVfsDirectory::RealVfsDirectory(const std::string& path_, Mode perms_)
92 perms(perms_) { 92 perms(perms_) {
93 if (!FileUtil::Exists(path) && (perms == Mode::Write || perms == Mode::Append)) 93 if (!FileUtil::Exists(path) && (perms == Mode::Write || perms == Mode::Append))
94 FileUtil::CreateDir(path); 94 FileUtil::CreateDir(path);
95 unsigned size; 95
96 if (perms == Mode::Append) 96 if (perms == Mode::Append)
97 return; 97 return;
98 98
99 FileUtil::ForeachDirectoryEntry( 99 FileUtil::ForeachDirectoryEntry(
100 &size, path, 100 nullptr, path,
101 [this](unsigned* entries_out, const std::string& directory, const std::string& filename) { 101 [this](u64* entries_out, const std::string& directory, const std::string& filename) {
102 std::string full_path = directory + DIR_SEP + filename; 102 std::string full_path = directory + DIR_SEP + filename;
103 if (FileUtil::IsDirectory(full_path)) 103 if (FileUtil::IsDirectory(full_path))
104 subdirectories.emplace_back(std::make_shared<RealVfsDirectory>(full_path, perms)); 104 subdirectories.emplace_back(std::make_shared<RealVfsDirectory>(full_path, perms));
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 394963a69..18bd62a08 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -20,7 +20,7 @@ namespace Loader {
20 20
21static std::string FindRomFS(const std::string& directory) { 21static std::string FindRomFS(const std::string& directory) {
22 std::string filepath_romfs; 22 std::string filepath_romfs;
23 const auto callback = [&filepath_romfs](unsigned*, const std::string& directory, 23 const auto callback = [&filepath_romfs](u64*, const std::string& directory,
24 const std::string& virtual_name) -> bool { 24 const std::string& virtual_name) -> bool {
25 const std::string physical_name = directory + virtual_name; 25 const std::string physical_name = directory + virtual_name;
26 if (FileUtil::IsDirectory(physical_name)) { 26 if (FileUtil::IsDirectory(physical_name)) {
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index e1ca0e77b..99e6634a1 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -394,7 +394,7 @@ void GameList::RefreshGameDirectory() {
394} 394}
395 395
396void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { 396void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
397 const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory, 397 const auto callback = [this, recursion](u64* num_entries_out, const std::string& directory,
398 const std::string& virtual_name) -> bool { 398 const std::string& virtual_name) -> bool {
399 std::string physical_name = directory + DIR_SEP + virtual_name; 399 std::string physical_name = directory + DIR_SEP + virtual_name;
400 400