refactor: settings for windows use Appdata/local, always save daemon log to app install path

This commit is contained in:
sithlord48 2025-03-29 15:53:36 -04:00 committed by Chris Rizzitello
parent 01878b0522
commit 3ed0915b57
2 changed files with 11 additions and 12 deletions

View file

@ -1,13 +1,12 @@
# Gui Config
# GUI Config
The search path for settings ar as follows:
The search order for a setting file is:
1. `<install-path>/settings/Deskflow.conf`
1. A user settings file
1. A system settings file
- 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
A new settings file will be created in the user path if no settings file is found.
The path of the settings file will be used as the base for all other config files.
### Windows
- System: `C:\ProgramData\Deskflow\Deskflow.conf`

View file

@ -40,16 +40,12 @@ Settings::Settings(QObject *parent) : QObject(parent)
if (QFile(m_portableSettingsFile).exists()) {
fileToLoad = m_portableSettingsFile;
} else {
#ifdef Q_OS_WIN
fileToLoad = SystemSettingFile;
#else
if (QFile(UserSettingFile).exists())
fileToLoad = UserSettingFile;
else if (QFile(SystemSettingFile).exists())
fileToLoad = SystemSettingFile;
else
fileToLoad = UserSettingFile;
#endif
}
m_settings = new QSettings(fileToLoad, QSettings::IniFormat);
@ -122,7 +118,11 @@ QVariant Settings::defaultValue(const QString &key)
return defaultProcessMode;
if (key == Daemon::LogFile) {
#ifdef Q_OS_WIN
return QStringLiteral("%1/%2").arg(QCoreApplication::applicationDirPath(), kDaemonLogFilename);
#else
return QStringLiteral("%1/%2").arg(instance()->settingsPath(), kDaemonLogFilename);
#endif
}
if (key == Daemon::Elevate)