refactor: settings, prefix portableSettingsFile with app dir at runtime
This commit is contained in:
committed by
Chris Rizzitello
parent
af6b42fe9e
commit
01878b0522
@ -1,3 +1,26 @@
|
||||
# Gui Config
|
||||
|
||||
The search path for settings ar as follows:
|
||||
|
||||
- Check Install_path/settings/Deskflow.conf
|
||||
- Check if User Settings Path
|
||||
- Check if System Settings File
|
||||
- Make a User Setting file
|
||||
|
||||
The path of the settings file will be used as the base for all other config files
|
||||
|
||||
### Windows
|
||||
- System: `C:\ProgramData\Deskflow\Deskflow.conf`
|
||||
- User: `C:\Users\userName\AppData\Local\Deskflow\Deskflow.conf`
|
||||
|
||||
### Linux
|
||||
- System: `/etc/Deskflow/Deskflow.conf`
|
||||
- User: `~/.config/Deskflow/Deskflow.conf`
|
||||
|
||||
### macOS
|
||||
- System: `/Library/Deskflow/Deskflow.conf`
|
||||
- User: `~/Library/Deskflow/Deskflow.conf`
|
||||
|
||||
# Server Config Examples
|
||||
|
||||
The `deskflow-server` command accepts the `-c` or `--config` option, which takes one argument,
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
#include "UrlConstants.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QRect>
|
||||
|
||||
@ -34,6 +35,7 @@ void Settings::setSettingFile(const QString &settingsFile)
|
||||
|
||||
Settings::Settings(QObject *parent) : QObject(parent)
|
||||
{
|
||||
m_portableSettingsFile = m_portableSettingsFile.arg(QCoreApplication::applicationDirPath(), kAppName);
|
||||
QString fileToLoad;
|
||||
if (QFile(m_portableSettingsFile).exists()) {
|
||||
fileToLoad = m_portableSettingsFile;
|
||||
|
||||
@ -163,7 +163,7 @@ private:
|
||||
void cleanSettings();
|
||||
|
||||
QSettings *m_settings = nullptr;
|
||||
QString m_portableSettingsFile = QStringLiteral("settings/%1.conf").arg(kAppName);
|
||||
QString m_portableSettingsFile = QStringLiteral("%1/settings/%2.conf");
|
||||
std::shared_ptr<QSettingsProxy> m_settingsProxy;
|
||||
|
||||
// clang-format off
|
||||
|
||||
Reference in New Issue
Block a user