summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qstandardpaths_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qstandardpaths_unix.cpp')
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index eaa545b4fd..0c276e0a56 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -284,16 +284,12 @@ static QStringList xdgDataDirs()
dirs.append(QString::fromLatin1("/usr/local/share"));
dirs.append(QString::fromLatin1("/usr/share"));
} else {
- dirs = xdgDataDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
+ const auto parts = xdgDataDirsEnv.splitRef(QLatin1Char(':'), QString::SkipEmptyParts);
// Normalize paths, skip relative paths
- QMutableListIterator<QString> it(dirs);
- while (it.hasNext()) {
- const QString dir = it.next();
- if (!dir.startsWith(QLatin1Char('/')))
- it.remove();
- else
- it.setValue(QDir::cleanPath(dir));
+ for (const QStringRef &dir : parts) {
+ if (dir.startsWith(QLatin1Char('/')))
+ dirs.push_back(QDir::cleanPath(dir.toString()));
}
// Remove duplicates from the list, there's no use for duplicated