Some better paths even for Windows.

This commit is contained in:
Martin Rotter 2017-02-19 08:41:57 +01:00
parent 81f54e0d1c
commit 6a839439e2
3 changed files with 9 additions and 13 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;