[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kconfig] /: Fix issue when reading path lists
From: Aleix Pol <null () kde ! org>
Date: 2018-09-28 17:02:42
Message-ID: E1g5wA6-0007aU-Nl () code ! kde ! org
[Download RAW message or body]
Git commit 5f340fc84d89df83d17199c1aa8586d698c8c910 by Aleix Pol.
Committed on 28/09/2018 at 17:01.
Pushed by apol into branch 'master'.
Fix issue when reading path lists
Summary: They were not being split properly.
Test Plan: Tests pass, including the new one.
Reviewers: #frameworks, dfaure
Reviewed By: dfaure
Subscribers: dfaure, anthonyfieroni, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D14162
M +6 -1 autotests/kconfigtest.cpp
M +6 -0 src/core/kconfigini.cpp
https://commits.kde.org/kconfig/5f340fc84d89df83d17199c1aa8586d698c8c910
diff --git a/autotests/kconfigtest.cpp b/autotests/kconfigtest.cpp
index 4ae6d5b..35075d1 100644
--- a/autotests/kconfigtest.cpp
+++ b/autotests/kconfigtest.cpp
@@ -521,7 +521,9 @@ void KConfigTest::testPath()
<< "withBraces[$e]=file://${HOME}/foo" << endl
<< "URL[$e]=file://${HOME}/foo" << endl
<< "hostname[$e]=$(hostname)" << endl
- << "noeol=foo"; // no EOL
+ << "escapes=aaa,bb/b,ccc\\,ccc" << endl
+ << "noeol=foo" // no EOL
+ ;
}
KConfig cf2(TEST_SUBDIR "pathtest");
KConfigGroup group = cf2.group("Test Group");
@@ -547,6 +549,9 @@ void KConfigTest::testPath()
#endif
QVERIFY(group.hasKey("noeol"));
QCOMPARE(group.readEntry("noeol", QString()), QString("foo"));
+
+ const auto val = QStringList { QStringLiteral("aaa"), QStringLiteral("bb/b"), \
QStringLiteral("ccc,ccc")}; + QCOMPARE(group.readPathEntry("escapes", \
QStringList()), val); }
void KConfigTest::testPersistenceOfExpandFlagForPath()
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
index 211b630..c7b36ef 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -793,6 +793,12 @@ void KConfigIniBackend::printableToString(BufferFragment \
*aString, const QFile & r++;
*r = ';';
break;
+ case ',':
+ // not really an escape sequence, but allowed in .desktop files, \
don't strip '\,' from the string + *r = '\\';
+ r++;
+ *r = ',';
+ break;
case 'x':
if (i + 2 < l) {
*r = charFromHex(str + i + 1, file, line);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic