mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-09 03:42:58 -08:00
Filter out non-deck files when building VDS (#5748)
This commit is contained in:
@@ -58,6 +58,12 @@ void VisualDeckStorageFolderDisplayWidget::refreshUi()
|
||||
header->setText(bannerText);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all files in the directory that have a .txt or .cod extension
|
||||
*
|
||||
* @param filePath The directory to search through
|
||||
* @param recursive Whether to search through subdirectories
|
||||
*/
|
||||
static QStringList getAllFiles(const QString &filePath, bool recursive)
|
||||
{
|
||||
QStringList allFiles;
|
||||
@@ -65,7 +71,7 @@ static QStringList getAllFiles(const QString &filePath, bool recursive)
|
||||
// QDirIterator with QDir::Files ensures only files are listed (no directories)
|
||||
auto flags =
|
||||
recursive ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags;
|
||||
QDirIterator it(filePath, QDir::Files, flags);
|
||||
QDirIterator it(filePath, {"*.txt", "*.cod"}, QDir::Files, flags);
|
||||
|
||||
while (it.hasNext()) {
|
||||
allFiles << it.next(); // Add each file path to the list
|
||||
|
||||
Reference in New Issue
Block a user