Filter out non-deck files when building VDS (#5748)

This commit is contained in:
RickyRister
2025-03-18 15:22:36 -07:00
committed by GitHub
parent 6c19254abd
commit 42301d4f1a

View File

@@ -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