Fix portable on OSX

This commit is contained in:
marco 2015-09-03 19:45:02 +02:00
parent b4c5729bf5
commit 44fefc20c2
2 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,7 @@
#include "settingscache.h"
#include <QSettings>
#include <QFile>
#include <QApplication>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
@ -10,7 +11,7 @@
QString SettingsCache::getSettingsPath()
{
QString file = "settings/";
QString file = qApp->applicationDirPath() + "settings/";
#ifndef PORTABLE_BUILD
#if QT_VERSION >= 0x050000
@ -27,10 +28,6 @@ QString SettingsCache::getSettingsPath()
void SettingsCache::translateLegacySettings()
{
#ifdef PORTABLE_BUILD
setDeckPath("data/decks");
setReplaysPath("data/replays");
setPicsPath("data/pics");
setSoundPath("data/sounds");
return;
#endif
@ -136,6 +133,13 @@ SettingsCache::SettingsCache()
if(!QFile(settingsPath+"global.ini").exists())
translateLegacySettings();
#ifdef PORTABLE_BUILD
setDeckPath(qApp->applicationDirPath() + "data/decks");
setReplaysPath(qApp->applicationDirPath() +"data/replays");
setPicsPath(qApp->applicationDirPath() + "data/pics");
setSoundPath(qApp->applicationDirPath() +"data/sounds");
#endif
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
lang = settings->value("personal/lang").toString();
keepalive = settings->value("personal/keepalive", 5).toInt();

View file

@ -516,7 +516,7 @@ bool SaveSetsPage::validatePage()
dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
#else
dataDir = "data";
dataDir = qApp->applicationDirPath() + "/data";
#endif
#ifdef PORTABLE_BUILD
@ -731,7 +731,7 @@ bool SaveTokensPage::validatePage()
dataDir = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
#endif
#else
dataDir = "data";
dataDir = qApp->applicationDirPath() + "/data";
#endif
#ifdef PORTABLE_BUILD