Skip to content

Commit

Permalink
Fixed config path for appimage
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Felixberger <[email protected]>
  • Loading branch information
Schildkroet committed Mar 6, 2024
1 parent 26e745e commit 2beb260
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/utils/profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@
// chosen for backward compatibility with pre-profiles versions, which always stored settings in `settings.ini`
const QString default_profile_name = "settings";

QStringList getProfileNames() {
QStringList getProfileNames()
{
const QDir configDir = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
const QStringList configFiles = configDir.entryList({"*.ini"}, QDir::Files);
QStringList rv;
for (QString configFile : configFiles) {
for (QString configFile : configFiles)
{
rv << QUrl::fromPercentEncoding(configFile.replace(QRegExp("\\.ini$"), "").toUtf8());
}
return rv;
}

QString configPathForProfile(QString profile_name) {
const QDir configDir = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
QString configPathForProfile(QString profile_name)
{
std::string configPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).toStdString();
auto pos = configPath.rfind('/');
if (pos != std::string::npos)
{
configPath.erase(pos);
}
QString tmp = QString::fromStdString(configPath) + "/Candle2";
QDir configDir(tmp);
return configDir.filePath(QUrl::toPercentEncoding(profile_name) + ".ini");
}

0 comments on commit 2beb260

Please sign in to comment.