diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-12 16:28:07 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-12 16:28:07 +0100 |
commit | a9c88c1f39c41215eb9d7288a1fd02aa865e8a04 (patch) | |
tree | d6229a2370f202d5ff8a5f56da1f43982bc524c2 /src/corelib/io/qstandardpaths_unix.cpp | |
parent | ff23fb6cf723bcc52a5f037ef92500c480ce5a5c (diff) | |
parent | 8e22d71b225576ae7ccd6ed349c05219bae7689e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/gui/image/qimage.cpp
src/gui/text/qtextengine.cpp
src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
src/printsupport/kernel/qprintengine_win.cpp
Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
Diffstat (limited to 'src/corelib/io/qstandardpaths_unix.cpp')
-rw-r--r-- | src/corelib/io/qstandardpaths_unix.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 1b9078f712..e2ed7c3766 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -205,6 +205,8 @@ QString QStandardPaths::writableLocation(StandardLocation type) // value can start with $HOME if (value.startsWith(QLatin1String("$HOME"))) value = QDir::homePath() + value.mid(5); + if (value.length() > 1 && value.endsWith(QLatin1Char('/'))) + value.chop(1); return value; } } @@ -257,10 +259,17 @@ static QStringList xdgDataDirs() dirs.append(QString::fromLatin1("/usr/local/share")); dirs.append(QString::fromLatin1("/usr/share")); } else { - dirs = xdgDataDirsEnv.split(QLatin1Char(':')); - // Normalize paths - for (int i = 0; i < dirs.count(); i++) - dirs[i] = QDir::cleanPath(dirs.at(i)); + dirs = xdgDataDirsEnv.split(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)); + } // Remove duplicates from the list, there's no use for duplicated // paths in XDG_DATA_DIRS - if it's not found in the given |