From e9f98dbe4ccc2066e35c626f003d2401a9ca83e2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Fri, 1 Jun 2018 10:01:37 +0200 Subject: Deal with broken lookup paths on osx --- framework/src/frameworkplugin.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/framework/src/frameworkplugin.cpp b/framework/src/frameworkplugin.cpp index 92c6df3a..a3461c66 100644 --- a/framework/src/frameworkplugin.cpp +++ b/framework/src/frameworkplugin.cpp @@ -134,6 +134,21 @@ void FrameworkPlugin::initializeEngine(QQmlEngine *engine, const char *uri) const auto locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation) + QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); kubeIcons = findFile(QStringLiteral("/kube/kube-icons.rcc"), locations); } + //For osx + if (kubeIcons.isEmpty()) { + //On Mac OS we want to include Contents/Resources/ in the bundle, and that path is in AppDataLocations. + QStringList iconSearchPaths; + for (const auto &p : QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)) { + auto iconPath = p; + //I'm getting broken paths reported from standardLocations + if (iconPath.contains("kube.appContents")) { + iconPath.replace("kube.appContents", "kube.app/Contents"); + } + iconSearchPaths << iconPath; + } + kubeIcons = findFile(QStringLiteral("/kube/kube-icons.rcc"), iconSearchPaths); + } + if (!QResource::registerResource(kubeIcons, "/icons/kube")) { qWarning() << "Failed to register icon resource!" << kubeIcons; qWarning() << "Searched paths: " << QStandardPaths::standardLocations(QStandardPaths::AppDataLocation) + QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); -- cgit v1.2.3