summaryrefslogtreecommitdiff
path: root/src/citra_qt
diff options
context:
space:
mode:
authorGravatar bunnei2015-11-28 23:12:45 -0500
committerGravatar bunnei2015-11-28 23:12:45 -0500
commit48265fa94c808e0caea1f540fda0b8076c8db6cf (patch)
tree9091b7807c44f585957037466dcfc88116490118 /src/citra_qt
parentMerge pull request #1254 from bunnei/fix-gl-uniforms (diff)
parentRefactor ScanDirectoryTreeAndCallback to separate errors and retvals (diff)
downloadyuzu-48265fa94c808e0caea1f540fda0b8076c8db6cf.tar.gz
yuzu-48265fa94c808e0caea1f540fda0b8076c8db6cf.tar.xz
yuzu-48265fa94c808e0caea1f540fda0b8076c8db6cf.zip
Merge pull request #1256 from archshift/refactor-scandir
Refactor ScanDirectoryTreeAndCallback to separate errors and retvals
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/game_list.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp
index e925f08a7..1f8d69a03 100644
--- a/src/citra_qt/game_list.cpp
+++ b/src/citra_qt/game_list.cpp
@@ -119,13 +119,14 @@ void GameList::LoadInterfaceLayout(QSettings& settings)
119 119
120void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool deep_scan) 120void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool deep_scan)
121{ 121{
122 const auto callback = [&](const std::string& directory, 122 const auto callback = [&](unsigned* num_entries_out,
123 const std::string& virtual_name) -> int { 123 const std::string& directory,
124 const std::string& virtual_name) -> bool {
124 125
125 std::string physical_name = directory + DIR_SEP + virtual_name; 126 std::string physical_name = directory + DIR_SEP + virtual_name;
126 127
127 if (stop_processing) 128 if (stop_processing)
128 return -1; // A negative return value breaks the callback loop. 129 return false; // Breaks the callback loop.
129 130
130 if (deep_scan && FileUtil::IsDirectory(physical_name)) { 131 if (deep_scan && FileUtil::IsDirectory(physical_name)) {
131 AddFstEntriesToGameList(physical_name, true); 132 AddFstEntriesToGameList(physical_name, true);
@@ -135,11 +136,11 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool d
135 136
136 Loader::FileType guessed_filetype = Loader::GuessFromExtension(filename_extension); 137 Loader::FileType guessed_filetype = Loader::GuessFromExtension(filename_extension);
137 if (guessed_filetype == Loader::FileType::Unknown) 138 if (guessed_filetype == Loader::FileType::Unknown)
138 return 0; 139 return true;
139 Loader::FileType filetype = Loader::IdentifyFile(physical_name); 140 Loader::FileType filetype = Loader::IdentifyFile(physical_name);
140 if (filetype == Loader::FileType::Unknown) { 141 if (filetype == Loader::FileType::Unknown) {
141 LOG_WARNING(Frontend, "File %s is of indeterminate type and is possibly corrupted.", physical_name.c_str()); 142 LOG_WARNING(Frontend, "File %s is of indeterminate type and is possibly corrupted.", physical_name.c_str());
142 return 0; 143 return true;
143 } 144 }
144 if (guessed_filetype != filetype) { 145 if (guessed_filetype != filetype) {
145 LOG_WARNING(Frontend, "Filetype and extension of file %s do not match.", physical_name.c_str()); 146 LOG_WARNING(Frontend, "Filetype and extension of file %s do not match.", physical_name.c_str());
@@ -152,9 +153,10 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool d
152 }); 153 });
153 } 154 }
154 155
155 return 0; // We don't care about the found entries 156 return true;
156 }; 157 };
157 FileUtil::ScanDirectoryTreeAndCallback(dir_path, callback); 158
159 FileUtil::ForeachDirectoryEntry(nullptr, dir_path, callback);
158} 160}
159 161
160void GameListWorker::run() 162void GameListWorker::run()