QTfrontend/util/DataManager.cpp
changeset 12295 ac57d564efce
parent 11046 47a8c19ecb60
child 13284 b504131f7405
--- a/QTfrontend/util/DataManager.cpp	Thu Apr 20 11:22:29 2017 -0400
+++ b/QTfrontend/util/DataManager.cpp	Fri Apr 21 17:42:09 2017 +0200
@@ -31,6 +31,7 @@
 #include "hwconsts.h"
 #include "HWApplication.h"
 #include "sdlkeys.h"
+#include "physfs.h"
 
 #include "DataManager.h"
 
@@ -61,7 +62,8 @@
 QStringList DataManager::entryList(
     const QString & subDirectory,
     QDir::Filters filters,
-    const QStringList & nameFilters
+    const QStringList & nameFilters,
+    bool withDLC
 ) const
 {
     QDir tmpDir(QString("physfs://%1").arg(subDirectory));
@@ -69,9 +71,13 @@
 
     // sort case-insensitive
     QMap<QString, QString> sortedFileNames;
+    QString absolutePath = datadir->absolutePath().toLocal8Bit().data();
     foreach ( QString fn, result)
     {
-        sortedFileNames.insert(fn.toLower(), fn);
+        // Filter out DLC entries if desired
+        QString realDir = PHYSFS_getRealDir(QString(subDirectory + "/" + fn).toLocal8Bit().data());
+        if(withDLC || realDir == absolutePath)
+            sortedFileNames.insert(fn.toLower(), fn);
     }
     result = sortedFileNames.values();