From d29ca4322fe338a46457a37860707060556bcbbc Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 6 Mar 2023 10:46:05 +0100 Subject: QmlDesigner: adjust content library paths in .app bundles Change-Id: I7109b25097d061dbbbc8828273b5d0acfe94bf3c Reviewed-by: Tim Jenssen (cherry picked from commit eb16c66552e3e0b9961c15ee7f851282c9fbdf80) --- .../contentlibrary/contentlibrarymaterialsmodel.cpp | 12 +++++++++--- .../components/contentlibrary/contentlibrarywidget.cpp | 8 +++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp index 2acc4499786..be2900008b7 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp @@ -9,8 +9,9 @@ #include "contentlibrarywidget.h" #include "qmldesignerconstants.h" -#include "utils/algorithm.h" -#include "utils/qtcassert.h" +#include +#include +#include #include #include @@ -95,7 +96,12 @@ void ContentLibraryMaterialsModel::loadMaterialBundle() if (m_matBundleExists || m_probeMatBundleDir) return; - QDir matBundleDir(qEnvironmentVariable("MATERIAL_BUNDLE_PATH")); + QDir matBundleDir; + + if (!qEnvironmentVariable("MATERIAL_BUNDLE_PATH").isEmpty()) + matBundleDir.setPath(qEnvironmentVariable("MATERIAL_BUNDLE_PATH")); + else if (Utils::HostOsInfo::isMacHost()) + matBundleDir.setPath(QCoreApplication::applicationDirPath() + "/../Resources/material_bundle"); // search for matBundleDir from exec dir and up if (matBundleDir.dirName() == ".") { diff --git a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp index 07f385e3046..0b0a2b76a20 100644 --- a/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/contentlibrary/contentlibrarywidget.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -229,7 +230,12 @@ void ContentLibraryWidget::setIsDragging(bool val) QString ContentLibraryWidget::findTextureBundlePath() { - QDir texBundleDir(qEnvironmentVariable("TEXTURE_BUNDLE_PATH")); + QDir texBundleDir; + + if (!qEnvironmentVariable("TEXTURE_BUNDLE_PATH").isEmpty()) + texBundleDir.setPath(qEnvironmentVariable("TEXTURE_BUNDLE_PATH")); + else if (Utils::HostOsInfo::isMacHost()) + texBundleDir.setPath(QCoreApplication::applicationDirPath() + "/../Resources/texture_bundle"); // search for matBundleDir from exec dir and up if (texBundleDir.dirName() == ".") { -- cgit v1.2.3