Some better paths even for Windows.
This commit is contained in:
parent
81f54e0d1c
commit
6a839439e2
|
@ -186,11 +186,9 @@ void Application::setMainForm(FormMain *main_form) {
|
||||||
m_mainForm = main_form;
|
m_mainForm = main_form;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
QString Application::getConfigHomePath() {
|
||||||
QString Application::getXdgConfigHomePath() {
|
|
||||||
return IOFactory::getSystemFolder(QStandardPaths::ConfigLocation);
|
return IOFactory::getSystemFolder(QStandardPaths::ConfigLocation);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
QString Application::getTempFolderPath() {
|
QString Application::getTempFolderPath() {
|
||||||
return IOFactory::getSystemFolder(QStandardPaths::TempLocation);
|
return IOFactory::getSystemFolder(QStandardPaths::TempLocation);
|
||||||
|
|
|
@ -83,10 +83,7 @@ class Application : public QtSingleApplication {
|
||||||
QString getTempFolderPath();
|
QString getTempFolderPath();
|
||||||
QString getDocumentsFolderPath();
|
QString getDocumentsFolderPath();
|
||||||
QString getHomeFolderPath();
|
QString getHomeFolderPath();
|
||||||
|
QString getConfigHomePath();
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
QString getXdgConfigHomePath();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void setMainForm(FormMain *main_form);
|
void setMainForm(FormMain *main_form);
|
||||||
|
|
||||||
|
|
|
@ -323,19 +323,15 @@ QString Settings::getAppPathUserFolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::getHomeUserFolder() {
|
QString Settings::getHomeUserFolder() {
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
// Fallback folder.
|
// 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)) {
|
if (QDir().exists(home_folder)) {
|
||||||
return home_folder;
|
return home_folder;
|
||||||
}
|
}
|
||||||
else {
|
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) {
|
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
|
// We will use PORTABLE settings only and only if it is available and NON-PORTABLE
|
||||||
// settings was not initialized before.
|
// 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;
|
const bool will_we_use_portable_settings = portable_settings_available && !non_portable_settings_exist;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (will_we_use_portable_settings) {
|
if (will_we_use_portable_settings) {
|
||||||
properties.m_type = SettingsProperties::Portable;
|
properties.m_type = SettingsProperties::Portable;
|
||||||
|
|
Loading…
Reference in New Issue