fixes linux compilation problem. add /usr/games/bin support for appPath (gentoo)
This commit is contained in:
@@ -58,7 +58,6 @@ ConfigFile::ConfigFile(int argc, char **argv) : noWriteAccess(0)
|
||||
logOnOffDefault = "1";
|
||||
claNoWriteAccess = "0";
|
||||
|
||||
|
||||
if(!noWriteAccess) {
|
||||
// Pfad und Dateinamen setzen
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//
|
||||
//
|
||||
#include "qthelper.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
QtHelper::QtHelper()
|
||||
{
|
||||
@@ -31,37 +31,10 @@ std::string QtHelper::stringToUtf8(const std::string &myString) {
|
||||
|
||||
std::string QtHelper::getDefaultLanguage() { return QLocale::system().name().toStdString(); }
|
||||
|
||||
QString QtHelper::getDataPath()
|
||||
{
|
||||
QString path(QCoreApplication::instance()->applicationDirPath());
|
||||
|
||||
#ifdef _WIN32
|
||||
path += "/data/";
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
if (QRegExp("Contents/MacOS/?$").indexIn(path) != -1) {
|
||||
// pointing into an macosx application bundle
|
||||
path += "/../Resources/data/";
|
||||
} else { path += "/data/"; }
|
||||
#else //Unix
|
||||
if (QRegExp("pokerth/?$").indexIn(path) != -1) {
|
||||
// there is an own application directory
|
||||
path += "/data/";
|
||||
} else if (QRegExp("bin/?$").indexIn(path) != -1) {
|
||||
// we are in a bin directory. e.g. /usr/bin
|
||||
path += "/../share/pokerth/data/";
|
||||
} else { path += "/data/"; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
return QDir::cleanPath(path) + "/";
|
||||
}
|
||||
|
||||
std::string QtHelper::getDataPathStdString(const char * /*argv0*/)
|
||||
{
|
||||
QString path(QCoreApplication::instance()->applicationDirPath());
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
path += "/data/";
|
||||
#else
|
||||
@@ -74,13 +47,15 @@ std::string QtHelper::getDataPathStdString(const char * /*argv0*/)
|
||||
if (QRegExp("pokerth/?$").indexIn(path) != -1) {
|
||||
// there is an own application directory
|
||||
path += "/data/";
|
||||
} else if (QRegExp("usr/games/bin/?$").indexIn(path) != -1) {
|
||||
// we are in /usr/games/bin (like gentoo linux does)
|
||||
path += "/../../share/games/pokerth/data/";
|
||||
} else if (QRegExp("bin/?$").indexIn(path) != -1) {
|
||||
// we are in a bin directory. e.g. /usr/bin
|
||||
path += "/../share/pokerth/data/";
|
||||
|
||||
} else { path += "/data/"; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
return (QDir::cleanPath(path) + "/").toUtf8().constData();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ public:
|
||||
std::string stringToUtf8(const std::string &);
|
||||
std::string getDefaultLanguage();
|
||||
|
||||
QString getDataPath();
|
||||
std::string getDataPathStdString(const char *argv0);
|
||||
};
|
||||
|
||||
|
||||
+4
-2
@@ -70,8 +70,7 @@ class Game;
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
//create defaultconfig
|
||||
ConfigFile *myConfig = new ConfigFile(argc, argv);
|
||||
|
||||
//ENABLE_LEAK_CHECK();
|
||||
|
||||
//_CrtSetBreakAlloc(49937);
|
||||
@@ -80,6 +79,9 @@ int main( int argc, char **argv )
|
||||
/////// can be removed for non-qt-guis ////////////
|
||||
QApplication a( argc, argv );
|
||||
|
||||
//create defaultconfig
|
||||
ConfigFile *myConfig = new ConfigFile(argc, argv);
|
||||
|
||||
// set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets
|
||||
a.setStyle(new QPlastiqueStyle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user