diff options
Diffstat (limited to 'src/corelib/io/qstandardpaths_unix.cpp')
-rw-r--r-- | src/corelib/io/qstandardpaths_unix.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp index 1c9fa278cd..61e2e03a3d 100644 --- a/src/corelib/io/qstandardpaths_unix.cpp +++ b/src/corelib/io/qstandardpaths_unix.cpp @@ -257,6 +257,17 @@ static QStringList xdgDataDirs() 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)); + + // Remove duplicates from the list, there's no use for duplicated + // paths in XDG_DATA_DIRS - if it's not found in the given + // directory the first time, it won't be there the second time. + // Plus duplicate paths causes problems for example for mimetypes, + // where duplicate paths here lead to duplicated mime types returned + // for a file, eg "text/plain,text/plain" instead of "text/plain" + dirs.removeDuplicates(); } return dirs; } |