Don't try to load projectM presets from an empty directory

This commit is contained in:
David Sansome 2010-06-22 19:44:38 +00:00
parent 0d8019de0d
commit 72fec9a8d1
1 changed files with 10 additions and 4 deletions

View File

@ -28,6 +28,7 @@
#include <QSettings>
#include <QCoreApplication>
#include <QFile>
#include <QDir>
#include <projectM.hpp>
@ -75,10 +76,15 @@ void ProjectMVisualisation::InitProjectM() {
QString preset_path;
foreach (const QString& path, paths) {
if (QFile::exists(path)) {
preset_path = path;
break;
}
if (!QFile::exists(path))
continue;
// Don't use empty directories
if (QDir(path).entryList(QDir::Files | QDir::NoDotAndDotDot).isEmpty())
continue;
preset_path = path;
break;
}
if (preset_path.isNull()) {