check datadir instead
authornemo
Thu, 31 Jan 2013 22:13:30 -0500
changeset 8464 c708b4f5cffc
parent 8462 19b1de9423ab
child 8466 29b891dbf2a0
check datadir instead
QTfrontend/model/MapModel.cpp
QTfrontend/model/ThemeModel.cpp
--- a/QTfrontend/model/MapModel.cpp	Thu Jan 31 21:28:08 2013 -0500
+++ b/QTfrontend/model/MapModel.cpp	Thu Jan 31 22:13:30 2013 -0500
@@ -26,6 +26,7 @@
 #include "physfs.h"
 #include "MapModel.h"
 #include "HWApplication.h"
+#include "hwconsts.h"
 
 MapModel::MapInfo MapModel::MapInfoRandom = {MapModel::GeneratedMap, "+rnd+", "", 0, "", "", ""};
 MapModel::MapInfo MapModel::MapInfoMaze = {MapModel::GeneratedMaze, "+maze+", "", 0, "", "", ""};
@@ -33,8 +34,6 @@
 
 void MapModel::loadMaps(MapType maptype)
 {
-    const QString appDir = QString(PHYSFS_getBaseDir());
-
     // this method resets the contents of this model (important to know for views).
     beginResetModel();
 
@@ -99,7 +98,7 @@
 
             // detect if map is dlc
             QString mapDir = PHYSFS_getRealDir(QString("Maps/%1/map.cfg").arg(map).toLocal8Bit().data());
-            dlc = !mapDir.startsWith(appDir);
+            dlc = !mapDir.startsWith(datadir->absolutePath());
 
             // let's use some semi-sane hedgehog limit, rather than none
             if (limit == 0)
--- a/QTfrontend/model/ThemeModel.cpp	Thu Jan 31 21:28:08 2013 -0500
+++ b/QTfrontend/model/ThemeModel.cpp	Thu Jan 31 22:13:30 2013 -0500
@@ -23,6 +23,7 @@
 
 #include "physfs.h"
 #include "ThemeModel.h"
+#include "hwconsts.h"
 
 ThemeModel::ThemeModel(QObject *parent) :
     QAbstractListModel(parent)
@@ -50,8 +51,6 @@
 
 void ThemeModel::loadThemes()
 {
-    const QString appDir = QString(PHYSFS_getBaseDir());
-
     beginResetModel();
 
     DataManager & datamgr = DataManager::instance();
@@ -77,7 +76,7 @@
 
         // detect if theme is dlc
         QString themeDir = PHYSFS_getRealDir(QString("Themes/%1/icon.png").arg(theme).toLocal8Bit().data());
-        dataset.insert(Qt::UserRole + 2, !themeDir.startsWith(appDir));
+        dataset.insert(Qt::UserRole + 2, !themeDir.startsWith(datadir->absolutePath()));
 
         // set icon path
         dataset.insert(Qt::UserRole + 1, iconpath);