refactor: settings, prefix portableSettingsFile with app dir at runtime

This commit is contained in:
sithlord48
2025-03-30 08:06:41 -04:00
committed by Chris Rizzitello
parent af6b42fe9e
commit 01878b0522
3 changed files with 26 additions and 1 deletions

View File

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

View File

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

View File

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