From b4c5729bf5441d11895bf2677a4b363bc937f598 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 3 Sep 2015 18:31:11 +0200 Subject: [PATCH 1/2] fix Decks, Pics replays & sounds paths on Portable build --- cockatrice/src/settingscache.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 3a1b7b5c..12963797 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -26,7 +26,13 @@ QString SettingsCache::getSettingsPath() void SettingsCache::translateLegacySettings() { - //NOTE Please remove this legacy setting translation after 2016-9-1 (+1 year after creation) +#ifdef PORTABLE_BUILD + setDeckPath("data/decks"); + setReplaysPath("data/replays"); + setPicsPath("data/pics"); + setSoundPath("data/sounds"); + return; +#endif //Layouts QFile layoutFile(getSettingsPath()+"layouts/deckLayout.ini"); @@ -627,4 +633,4 @@ void SettingsCache::setNotifyAboutUpdate(int _notifyaboutupdate) { notifyAboutUpdates = _notifyaboutupdate; settings->setValue("personal/updatenotification", notifyAboutUpdates); -} \ No newline at end of file +} From 44fefc20c21763f7935a859481833ba4c6cf5a25 Mon Sep 17 00:00:00 2001 From: marco Date: Thu, 3 Sep 2015 19:45:02 +0200 Subject: [PATCH 2/2] Fix portable on OSX --- cockatrice/src/settingscache.cpp | 14 +++++++++----- oracle/src/oraclewizard.cpp | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 12963797..72e3abe2 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -1,6 +1,7 @@ #include "settingscache.h" #include #include +#include #if QT_VERSION >= 0x050000 #include @@ -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(); diff --git a/oracle/src/oraclewizard.cpp b/oracle/src/oraclewizard.cpp index 32bfe6f7..4a994034 100644 --- a/oracle/src/oraclewizard.cpp +++ b/oracle/src/oraclewizard.cpp @@ -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