Skip to content

Commit 2be34f9

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

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

src/launch/launch.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <qprocess.h>
1313
#include <qqmldebug.h>
1414
#include <qquickwindow.h>
15+
#include <qstandardpaths.h>
1516
#include <qstring.h>
1617
#include <qtenvironmentvariables.h>
1718
#include <qtextstream.h>
@@ -196,21 +197,12 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
196197
{
197198
QList<QString> dataPaths;
198199

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-
207200
auto fallbackPaths = QIcon::fallbackSearchPaths();
208201

209-
for (auto& path: dataPaths) {
210-
auto newPath = QDir(path).filePath("pixmaps");
211-
212-
if (!fallbackPaths.contains(newPath)) {
213-
fallbackPaths.push_back(newPath);
202+
for (const auto& dir: QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation)) {
203+
for (const auto& suffix: {"/icons", "/pixmaps"}) {
204+
QString path = dir + suffix;
205+
if (!fallbackPaths.contains(path)) fallbackPaths.append(path);
214206
}
215207
}
216208

0 commit comments

Comments
 (0)