forked from qt-creator/qt-creator
Utils::NameValueDictionary: Use the right path list separator
The environment is not necessarily for the host OS. Change-Id: Ib0b0d3b8447fbb83c3860fb941b5d2445b8585d0 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -134,14 +134,6 @@ void NameValueDictionary::modify(const NameValueItems &items)
|
|||||||
*this = resultKeyValueDictionary;
|
*this = resultKeyValueDictionary;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum : char {
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
pathSepC = ';'
|
|
||||||
#else
|
|
||||||
pathSepC = ':'
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
NameValueItems NameValueDictionary::diff(const NameValueDictionary &other, bool checkAppendPrepend) const
|
NameValueItems NameValueDictionary::diff(const NameValueDictionary &other, bool checkAppendPrepend) const
|
||||||
{
|
{
|
||||||
NameValueMap::const_iterator thisIt = constBegin();
|
NameValueMap::const_iterator thisIt = constBegin();
|
||||||
@@ -172,13 +164,13 @@ NameValueItems NameValueDictionary::diff(const NameValueDictionary &other, bool
|
|||||||
if (checkAppendPrepend && newValue.startsWith(oldValue)
|
if (checkAppendPrepend && newValue.startsWith(oldValue)
|
||||||
&& oldEnabled == newEnabled) {
|
&& oldEnabled == newEnabled) {
|
||||||
QString appended = newValue.right(newValue.size() - oldValue.size());
|
QString appended = newValue.right(newValue.size() - oldValue.size());
|
||||||
if (appended.startsWith(QLatin1Char(pathSepC)))
|
if (appended.startsWith(OsSpecificAspects::pathListSeparator(osType())))
|
||||||
appended.remove(0, 1);
|
appended.remove(0, 1);
|
||||||
result.append(NameValueItem(otherIt.key(), appended, NameValueItem::Append));
|
result.append(NameValueItem(otherIt.key(), appended, NameValueItem::Append));
|
||||||
} else if (checkAppendPrepend && newValue.endsWith(oldValue)
|
} else if (checkAppendPrepend && newValue.endsWith(oldValue)
|
||||||
&& oldEnabled == newEnabled) {
|
&& oldEnabled == newEnabled) {
|
||||||
QString prepended = newValue.left(newValue.size() - oldValue.size());
|
QString prepended = newValue.left(newValue.size() - oldValue.size());
|
||||||
if (prepended.endsWith(QLatin1Char(pathSepC)))
|
if (prepended.endsWith(OsSpecificAspects::pathListSeparator(osType())))
|
||||||
prepended.chop(1);
|
prepended.chop(1);
|
||||||
result.append(NameValueItem(otherIt.key(), prepended, NameValueItem::Prepend));
|
result.append(NameValueItem(otherIt.key(), prepended, NameValueItem::Prepend));
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user