Skip to content

Commit c85b605

Browse files
committed
core: improve named icon detection
1 parent 1e4d804 commit c85b605

1 file changed

Lines changed: 5 additions & 16 deletions

File tree

src/launch/launch.cpp

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#include <qhash.h>
99
#include <qlist.h>
1010
#include <qlogging.h>
11-
#include <qnamespace.h>
1211
#include <qprocess.h>
1312
#include <qqmldebug.h>
1413
#include <qquickwindow.h>
14+
#include <qstandardpaths.h>
1515
#include <qstring.h>
1616
#include <qtenvironmentvariables.h>
1717
#include <qtextstream.h>
@@ -194,23 +194,12 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
194194
// Some programs place icons in the pixmaps folder instead of the icons folder.
195195
// This seems to be controlled by the QPA and qt6ct does not provide it.
196196
{
197-
QList<QString> dataPaths;
198-
199-
if (qEnvironmentVariableIsSet("XDG_DATA_DIRS")) {
200-
auto var = qEnvironmentVariable("XDG_DATA_DIRS");
201-
dataPaths = var.split(u':', Qt::SkipEmptyParts);
202-
} else {
203-
dataPaths.push_back("/usr/local/share");
204-
dataPaths.push_back("/usr/share");
205-
}
206-
207197
auto fallbackPaths = QIcon::fallbackSearchPaths();
208198

209-
for (auto& path: dataPaths) {
210-
auto newPath = QDir(path).filePath("pixmaps");
211-
212-
if (!fallbackPaths.contains(newPath)) {
213-
fallbackPaths.push_back(newPath);
199+
for (const auto& dir: QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) {
200+
for (const auto& suffix: {"/icons", "/pixmaps"}) {
201+
const QString path = dir + suffix;
202+
if (!fallbackPaths.contains(path)) fallbackPaths.append(path);
214203
}
215204
}
216205

0 commit comments

Comments
 (0)