diff options
| author | 2017-02-12 21:28:56 +0100 | |
|---|---|---|
| committer | 2017-02-12 12:28:56 -0800 | |
| commit | 30ff675f0284a2ed972fa6cc944e0a96c56d4dd6 (patch) | |
| tree | 32e88bf2d1846f9778b0b1d0600429c67dc2298e /src/citra_qt/game_list.cpp | |
| parent | core: Free AppLoader on shutdown to release file (#2558) (diff) | |
| download | yuzu-30ff675f0284a2ed972fa6cc944e0a96c56d4dd6.tar.gz yuzu-30ff675f0284a2ed972fa6cc944e0a96c56d4dd6.tar.xz yuzu-30ff675f0284a2ed972fa6cc944e0a96c56d4dd6.zip | |
citra-qt: Don't attempt to scan files with unsupported extensions (#2402)
Diffstat (limited to 'src/citra_qt/game_list.cpp')
| -rw-r--r-- | src/citra_qt/game_list.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 09469f3c5..28e01d81a 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QFileInfo> | ||
| 5 | #include <QHeaderView> | 6 | #include <QHeaderView> |
| 6 | #include <QMenu> | 7 | #include <QMenu> |
| 7 | #include <QThreadPool> | 8 | #include <QThreadPool> |
| @@ -131,6 +132,14 @@ void GameList::LoadInterfaceLayout() { | |||
| 131 | item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); | 132 | item_model->sort(header->sortIndicatorSection(), header->sortIndicatorOrder()); |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 135 | const QStringList GameList::supported_file_extensions = {"3ds", "3dsx", "elf", "axf", | ||
| 136 | "cci", "cxi", "app"}; | ||
| 137 | |||
| 138 | static bool HasSupportedFileExtension(const std::string& file_name) { | ||
| 139 | QFileInfo file = QFileInfo(file_name.c_str()); | ||
| 140 | return GameList::supported_file_extensions.contains(file.completeSuffix(), Qt::CaseInsensitive); | ||
| 141 | } | ||
| 142 | |||
| 134 | void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { | 143 | void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) { |
| 135 | const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory, | 144 | const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory, |
| 136 | const std::string& virtual_name) -> bool { | 145 | const std::string& virtual_name) -> bool { |
| @@ -139,7 +148,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign | |||
| 139 | if (stop_processing) | 148 | if (stop_processing) |
| 140 | return false; // Breaks the callback loop. | 149 | return false; // Breaks the callback loop. |
| 141 | 150 | ||
| 142 | if (!FileUtil::IsDirectory(physical_name)) { | 151 | if (!FileUtil::IsDirectory(physical_name) && HasSupportedFileExtension(physical_name)) { |
| 143 | std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); | 152 | std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name); |
| 144 | if (!loader) | 153 | if (!loader) |
| 145 | return true; | 154 | return true; |