diff options
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index aee0eb5..5d78cb7 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -46,10 +46,12 @@ Settings::Settings(const QString &configFile) path = configFile; homeLocation = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); settingsLocation = QFileInfo(configFile).dir().absolutePath(); + cacheLocation = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); qDebug("Read configuration: [%s]", qUtf8Printable(configFile)); - qDebug("~ => '%s'", qUtf8Printable(homeLocation)); - qDebug("~settings => '%s'", qUtf8Printable(settingsLocation)); + qDebug("$home | '%s'", qUtf8Printable(homeLocation)); + qDebug("$settings | '%s'", qUtf8Printable(settingsLocation)); + qDebug("$cache | '%s'", qUtf8Printable(cacheLocation)); } Settings::~Settings() @@ -120,8 +122,11 @@ QVariant Settings::value(const QString &key, const QVariant &defaultValue) const // check if key is a path, in which case replace '~' with the home location if(key.endsWith(QLatin1String("path"), Qt::CaseInsensitive)) { QString value = r.toString(); - value.replace("~settings", settingsLocation); - value.replace('~', homeLocation); + while(value.contains('$')) { + value.replace("$settings", settingsLocation); + value.replace("$cache", cacheLocation); + value.replace("$home", homeLocation); + } r = QVariant(value); } |