diff options
| author | 2016-05-30 20:59:10 -0400 | |
|---|---|---|
| committer | 2016-05-30 20:59:10 -0400 | |
| commit | 08e09184df753c9622df263e1731e1890afd3eb2 (patch) | |
| tree | 7640df3c67947ff7ee9ef0d4003c33ac2fbf7c96 /src/citra_qt/game_list.cpp | |
| parent | Merge pull request #1692 from Subv/rm_getpointer2 (diff) | |
| parent | Common: Make recursive FileUtil functions take a maximum recursion (diff) | |
| download | yuzu-08e09184df753c9622df263e1731e1890afd3eb2.tar.gz yuzu-08e09184df753c9622df263e1731e1890afd3eb2.tar.xz yuzu-08e09184df753c9622df263e1731e1890afd3eb2.zip | |
Merge pull request #1751 from linkmauve/no-recursive-readdir
Make recursive FileUtil functions take a maximum recursion
Diffstat (limited to 'src/citra_qt/game_list.cpp')
| -rw-r--r-- | src/citra_qt/game_list.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 570647539..49cb98e70 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp | |||
| @@ -118,19 +118,20 @@ void GameList::LoadInterfaceLayout() | |||
| 118 | item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); | 118 | item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool deep_scan) | 121 | void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) |
| 122 | { | 122 | { |
| 123 | const auto callback = [&](unsigned* num_entries_out, | 123 | const auto callback = [&](unsigned* num_entries_out, |
| 124 | const std::string& directory, | 124 | const std::string& directory, |
| 125 | const std::string& virtual_name) -> bool { | 125 | const std::string& virtual_name, |
| 126 | unsigned int recursion) -> bool { | ||
| 126 | 127 | ||
| 127 | std::string physical_name = directory + DIR_SEP + virtual_name; | 128 | std::string physical_name = directory + DIR_SEP + virtual_name; |
| 128 | 129 | ||
| 129 | if (stop_processing) | 130 | if (stop_processing) |
| 130 | return false; // Breaks the callback loop. | 131 | return false; // Breaks the callback loop. |
| 131 | 132 | ||
| 132 | if (deep_scan && FileUtil::IsDirectory(physical_name)) { | 133 | if (recursion > 0 && FileUtil::IsDirectory(physical_name)) { |
| 133 | AddFstEntriesToGameList(physical_name, true); | 134 | AddFstEntriesToGameList(physical_name, recursion - 1); |
| 134 | } else { | 135 | } else { |
| 135 | std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); | 136 | std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); |
| 136 | if (!loader) | 137 | if (!loader) |
| @@ -155,7 +156,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, bool d | |||
| 155 | void GameListWorker::run() | 156 | void GameListWorker::run() |
| 156 | { | 157 | { |
| 157 | stop_processing = false; | 158 | stop_processing = false; |
| 158 | AddFstEntriesToGameList(dir_path.toStdString(), deep_scan); | 159 | AddFstEntriesToGameList(dir_path.toStdString(), deep_scan ? 256 : 0); |
| 159 | emit Finished(); | 160 | emit Finished(); |
| 160 | } | 161 | } |
| 161 | 162 | ||