QStandardPaths/Unix: use QStringTokenizer
Avoids having to allocate storage to hold the parts. Since the
startsWith('/') will fail for empty parts, remove the SkipEmptyParts
so we don't check for emptiness twice.
Change-Id: Id33a52d5fbd29f7a9d4ead758729195bb201a369
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
parent
dd3c4b66a1
commit
8948f5cc78
|
|
@ -354,10 +354,8 @@ static QStringList xdgDataDirs()
|
|||
dirs.append(QString::fromLatin1("/usr/local/share"));
|
||||
dirs.append(QString::fromLatin1("/usr/share"));
|
||||
} else {
|
||||
const auto parts = QStringView{xdgDataDirsEnv}.split(QLatin1Char(':'), Qt::SkipEmptyParts);
|
||||
|
||||
// Normalize paths, skip relative paths
|
||||
for (const auto &dir : parts) {
|
||||
for (const auto dir : qTokenize(xdgDataDirsEnv, u':')) {
|
||||
if (dir.startsWith(QLatin1Char('/')))
|
||||
dirs.push_back(QDir::cleanPath(dir.toString()));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue