From 6a839439e244d9d0919656cf2279ef8b76c4f2c5 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 19 Feb 2017 08:41:57 +0100 Subject: [PATCH] Some better paths even for Windows. --- src/miscellaneous/application.cpp | 4 +--- src/miscellaneous/application.h | 5 +---- src/miscellaneous/settings.cpp | 13 +++++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index 9b64be8cf..56d77acdc 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -186,11 +186,9 @@ void Application::setMainForm(FormMain *main_form) { m_mainForm = main_form; } -#if defined(Q_OS_LINUX) -QString Application::getXdgConfigHomePath() { +QString Application::getConfigHomePath() { return IOFactory::getSystemFolder(QStandardPaths::ConfigLocation); } -#endif QString Application::getTempFolderPath() { return IOFactory::getSystemFolder(QStandardPaths::TempLocation); diff --git a/src/miscellaneous/application.h b/src/miscellaneous/application.h index feaed0fee..a71a7453a 100755 --- a/src/miscellaneous/application.h +++ b/src/miscellaneous/application.h @@ -83,10 +83,7 @@ class Application : public QtSingleApplication { QString getTempFolderPath(); QString getDocumentsFolderPath(); QString getHomeFolderPath(); - -#if defined(Q_OS_LINUX) - QString getXdgConfigHomePath(); -#endif + QString getConfigHomePath(); void setMainForm(FormMain *main_form); diff --git a/src/miscellaneous/settings.cpp b/src/miscellaneous/settings.cpp index 3aa99b91d..e9e21fb09 100755 --- a/src/miscellaneous/settings.cpp +++ b/src/miscellaneous/settings.cpp @@ -323,19 +323,15 @@ QString Settings::getAppPathUserFolder() { } QString Settings::getHomeUserFolder() { -#if defined(Q_OS_LINUX) // Fallback folder. - QString home_folder = qApp->getHomeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QSL("data"); + QString home_folder = qApp->getHomeFolderPath() + QDir::separator() + QSL(APP_LOW_H_NAME) + QDir::separator() + QSL("data"); if (QDir().exists(home_folder)) { return home_folder; } else { - return qApp->getXdgConfigHomePath() + QDir::separator() + QString(APP_NAME); + return qApp->getConfigHomePath() + QDir::separator() + QSL(APP_NAME); } -#else - return qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QSL("data"); -#endif } Settings *Settings::setupSettings(QObject *parent) { @@ -377,7 +373,12 @@ SettingsProperties Settings::determineProperties() { // We will use PORTABLE settings only and only if it is available and NON-PORTABLE // settings was not initialized before. +#if defined (Q_OS_LINUX) + // DO NOT use portable settings for Linux, it is really not used on that platform. + const bool will_we_use_portable_settings = false; +#else const bool will_we_use_portable_settings = portable_settings_available && !non_portable_settings_exist; +#endif if (will_we_use_portable_settings) { properties.m_type = SettingsProperties::Portable;