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
wilder
Aleix Pol 8 years ago
parent 217c0b00f5
commit 5f340fc84d
  1. 7
      autotests/kconfigtest.cpp
  2. 6
      src/core/kconfigini.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()

@ -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);

Loading…
Cancel
Save