fix: config file location under Linux should contain app name

This commit is contained in:
Gary Wang 2023-06-27 00:36:34 +08:00
parent 1e3d68df1c
commit 7db7cfd85a
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760

View File

@ -106,9 +106,9 @@ Settings::Settings()
} }
#endif // FLAG_PORTABLE_MODE_SUPPORT #endif // FLAG_PORTABLE_MODE_SUPPORT
// %LOCALAPPDATA% under Windows.
if (configPath.isEmpty()) { if (configPath.isEmpty()) {
configPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); // %LOCALAPPDATA%\<APPNAME> under Windows, ~/.config/<APPNAME> under Linux.
configPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
} }
m_qsettings = new QSettings(QDir(configPath).absoluteFilePath("config.ini"), QSettings::IniFormat, this); m_qsettings = new QSettings(QDir(configPath).absoluteFilePath("config.ini"), QSettings::IniFormat, this);