diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-04-15 10:53:14 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-04-15 10:05:41 +0000 |
commit | 6b726e800b96efbf5a7b77dac524c60a8b421b8d (patch) | |
tree | d9eab4fb6070a6d2f59fad568d30750289916fd8 | |
parent | 582e2d4a00f1d9fc25eb44dcaf778e78c5c13ed9 (diff) |
Fix handling of preferences.qbsSearchPaths.v1.4.0
1) The code interpreted this value as a single string with entries
separated by the path separator. The value was, however, intended
(and documented) to be a list of strings.
2) Values in profile-specific preferences would overwrite top-level
preferences instead of merging them.
Task-number: QBS-777
Change-Id: Ie67d4380d6dfed66046f8c9bad6c986a858e81de
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | src/lib/corelib/tools/preferences.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/corelib/tools/preferences.cpp b/src/lib/corelib/tools/preferences.cpp index 114849436..ed3c74acd 100644 --- a/src/lib/corelib/tools/preferences.cpp +++ b/src/lib/corelib/tools/preferences.cpp @@ -113,9 +113,12 @@ QVariant Preferences::getPreference(const QString &key, const QVariant &defaultV { const QString fullKey = QLatin1String("preferences.") + key; if (!m_profile.isEmpty()) { - const QVariant value = Profile(m_profile, m_settings).value(fullKey); - if (value.isValid()) + QVariant value = Profile(m_profile, m_settings).value(fullKey); + if (value.isValid()) { + if (key == QLatin1String("qbsSearchPaths")) // Merge with top-level value. + value = value.toStringList() + m_settings->value(fullKey).toStringList(); return value; + } } return m_settings->value(fullKey, defaultValue); @@ -123,8 +126,7 @@ QVariant Preferences::getPreference(const QString &key, const QVariant &defaultV QStringList Preferences::pathList(const QString &key, const QString &defaultValue) const { - QStringList paths = getPreference(key).toString().split( - Internal::HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); + QStringList paths = getPreference(key).toStringList(); paths << defaultValue; return paths; } |