diff options
author | Tim Jenssen <[email protected]> | 2023-03-06 10:46:05 +0100 |
---|---|---|
committer | Tim Jenssen <[email protected]> | 2023-03-06 10:08:10 +0000 |
commit | d29ca4322fe338a46457a37860707060556bcbbc (patch) | |
tree | 66219ea5580e38a4531e3c47f67a71cf8d8cc9ab | |
parent | 303b5342732f50ad80fca94ed4e732a36f9951ce (diff) |
QmlDesigner: adjust content library paths in .app bundles
Change-Id: I7109b25097d061dbbbc8828273b5d0acfe94bf3c
Reviewed-by: Tim Jenssen <[email protected]>
(cherry picked from commit eb16c66552e3e0b9961c15ee7f851282c9fbdf80)
-rw-r--r-- | src/plugins/qmldesigner/components/contentlibrary/contentlibrarymaterialsmodel.cpp | 12 | ||||
-rw-r--r-- | src/plugins/qmldesigner/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 <utils/algorithm.h> +#include <utils/hostosinfo.h> +#include <utils/qtcassert.h> #include <QCoreApplication> #include <QJsonArray> @@ -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 <theme.h> #include <utils/algorithm.h> +#include <utils/hostosinfo.h> #include <utils/qtcassert.h> #include <QMimeData> @@ -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() == ".") { |