mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-23 23:23:55 -07:00
Filter out non-deck files when building VDS (#5748)
This commit is contained in:
parent
6c19254abd
commit
42301d4f1a
1 changed files with 7 additions and 1 deletions
|
|
@ -58,6 +58,12 @@ void VisualDeckStorageFolderDisplayWidget::refreshUi()
|
||||||
header->setText(bannerText);
|
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)
|
static QStringList getAllFiles(const QString &filePath, bool recursive)
|
||||||
{
|
{
|
||||||
QStringList allFiles;
|
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)
|
// QDirIterator with QDir::Files ensures only files are listed (no directories)
|
||||||
auto flags =
|
auto flags =
|
||||||
recursive ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags;
|
recursive ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags;
|
||||||
QDirIterator it(filePath, QDir::Files, flags);
|
QDirIterator it(filePath, {"*.txt", "*.cod"}, QDir::Files, flags);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
allFiles << it.next(); // Add each file path to the list
|
allFiles << it.next(); // Add each file path to the list
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue