diff --git a/pcsx2-qt/Settings/GameListSettingsWidget.cpp b/pcsx2-qt/Settings/GameListSettingsWidget.cpp
index 4a2434bee4..b91e079782 100644
--- a/pcsx2-qt/Settings/GameListSettingsWidget.cpp
+++ b/pcsx2-qt/Settings/GameListSettingsWidget.cpp
@@ -51,6 +51,7 @@ GameListSettingsWidget::GameListSettingsWidget(SettingsDialog* dialog, QWidget*
&GameListSettingsWidget::onAddSearchDirectoryButtonClicked);
connect(m_ui.removeSearchDirectoryButton, &QPushButton::clicked, this,
&GameListSettingsWidget::onRemoveSearchDirectoryButtonClicked);
+ connect(m_ui.addExcludedFile, &QPushButton::clicked, this, &GameListSettingsWidget::onAddExcludedFileButtonClicked);
connect(m_ui.addExcludedPath, &QPushButton::clicked, this, &GameListSettingsWidget::onAddExcludedPathButtonClicked);
connect(m_ui.removeExcludedPath, &QPushButton::clicked, this,
&GameListSettingsWidget::onRemoveExcludedPathButtonClicked);
@@ -215,10 +216,21 @@ void GameListSettingsWidget::onRemoveSearchDirectoryButtonClicked()
delete item;
}
+void GameListSettingsWidget::onAddExcludedFileButtonClicked()
+{
+ QString path =
+ QDir::toNativeSeparators(QFileDialog::getOpenFileName(QtUtils::GetRootWidget(this), tr("Select File")));
+ if (path.isEmpty())
+ return;
+
+ addExcludedPath(path.toStdString());
+}
+
void GameListSettingsWidget::onAddExcludedPathButtonClicked()
{
QString path =
- QDir::toNativeSeparators(QFileDialog::getOpenFileName(QtUtils::GetRootWidget(this), tr("Select Path")));
+ QDir::toNativeSeparators(QFileDialog::getExistingDirectory(QtUtils::GetRootWidget(this), tr("Select Directory")));
+
if (path.isEmpty())
return;
diff --git a/pcsx2-qt/Settings/GameListSettingsWidget.h b/pcsx2-qt/Settings/GameListSettingsWidget.h
index b5854d8564..eaa76d7671 100644
--- a/pcsx2-qt/Settings/GameListSettingsWidget.h
+++ b/pcsx2-qt/Settings/GameListSettingsWidget.h
@@ -39,6 +39,7 @@ private Q_SLOTS:
void onDirectoryListContextMenuRequested(const QPoint& point);
void onAddSearchDirectoryButtonClicked();
void onRemoveSearchDirectoryButtonClicked();
+ void onAddExcludedFileButtonClicked();
void onAddExcludedPathButtonClicked();
void onRemoveExcludedPathButtonClicked();
void onScanForNewGamesClicked();
diff --git a/pcsx2-qt/Settings/GameListSettingsWidget.ui b/pcsx2-qt/Settings/GameListSettingsWidget.ui
index 01979ee6ed..de8989b799 100644
--- a/pcsx2-qt/Settings/GameListSettingsWidget.ui
+++ b/pcsx2-qt/Settings/GameListSettingsWidget.ui
@@ -57,12 +57,15 @@
- Add
+ Add...
..
+
+ Qt::ToolButtonTextBesideIcon
+
-
@@ -80,6 +83,9 @@
..
+
+ Qt::ToolButtonTextBesideIcon
+
@@ -129,12 +135,35 @@
- Add
+ Directory...
+
+
+
+ ..
+
+
+ Qt::ToolButtonTextBesideIcon
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ File...
..
+
+ Qt::ToolButtonTextBesideIcon
+
-
@@ -152,6 +181,9 @@
..
+
+ Qt::ToolButtonTextBesideIcon
+
diff --git a/pcsx2-qt/SetupWizardDialog.ui b/pcsx2-qt/SetupWizardDialog.ui
index 773a25f939..22d5fed848 100644
--- a/pcsx2-qt/SetupWizardDialog.ui
+++ b/pcsx2-qt/SetupWizardDialog.ui
@@ -371,12 +371,15 @@
- Add
+ Add...
..
+
+ Qt::ToolButtonTextBesideIcon
+
-
@@ -394,6 +397,9 @@
..
+
+ Qt::ToolButtonTextBesideIcon
+
diff --git a/pcsx2/GameList.cpp b/pcsx2/GameList.cpp
index 5d09c8e0a5..b601da3369 100644
--- a/pcsx2/GameList.cpp
+++ b/pcsx2/GameList.cpp
@@ -582,7 +582,7 @@ void GameList::RewriteCacheFile()
static bool IsPathExcluded(const std::vector& excluded_paths, const std::string& path)
{
- return (std::find(excluded_paths.begin(), excluded_paths.end(), path) != excluded_paths.end());
+ return std::find_if(excluded_paths.begin(), excluded_paths.end(), [&path](const std::string& entry) { return path.starts_with(entry); }) != excluded_paths.end();
}
void GameList::ScanDirectory(const char* path, bool recursive, bool only_cache, const std::vector& excluded_paths,
@@ -596,7 +596,7 @@ void GameList::ScanDirectory(const char* path, bool recursive, bool only_cache,
FileSystem::FindResultsArray files;
FileSystem::FindFiles(path, "*",
recursive ? (FILESYSTEM_FIND_FILES | FILESYSTEM_FIND_HIDDEN_FILES | FILESYSTEM_FIND_RECURSIVE) :
- (FILESYSTEM_FIND_FILES | FILESYSTEM_FIND_HIDDEN_FILES),
+ (FILESYSTEM_FIND_FILES | FILESYSTEM_FIND_HIDDEN_FILES),
&files);
u32 files_scanned = 0;
@@ -808,7 +808,7 @@ bool GameList::RescanPath(const std::string& path)
{
// cancel if excluded
const std::vector excluded_paths(Host::GetBaseStringListSetting("GameList", "ExcludedPaths"));
- if (std::find(excluded_paths.begin(), excluded_paths.end(), path) != excluded_paths.end())
+ if (IsPathExcluded(excluded_paths, path))
return false;
}