summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/core_module.pro2
-rw-r--r--src/core/web_engine_library_info.cpp33
2 files changed, 31 insertions, 4 deletions
diff --git a/src/core/core_module.pro b/src/core/core_module.pro
index 68d46cd5a..3ad041d74 100644
--- a/src/core/core_module.pro
+++ b/src/core/core_module.pro
@@ -70,7 +70,7 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat
locales.CONFIG += no_check_exist
locales.path = $$[QT_INSTALL_TRANSLATIONS]/qtwebengine_locales
resources.CONFIG += no_check_exist
- resources.path = $$[QT_INSTALL_DATA]
+ resources.path = $$[QT_INSTALL_DATA]/resources
icu.CONFIG += no_check_exist
icu.path = $$[QT_INSTALL_DATA]
INSTALLS += icu locales resources
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index bc030d8f7..7b8858e44 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -225,6 +225,33 @@ QString libraryDataPath()
return potentialDataPath;
#endif
}
+
+QString resourcesDataPath()
+{
+#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
+ return getResourcesPath(frameworkBundle());
+#else
+ static bool initialized = false;
+ static QString potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources");
+ if (!initialized) {
+ initialized = true;
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
+ qWarning("Qt WebEngine resources not found at %s. Trying parent directory...", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath);
+ }
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
+ qWarning("Qt WebEngine resources not found at %s. Trying application directory...", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = QCoreApplication::applicationDirPath();
+ }
+ if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
+ qWarning("Qt WebEngine resources not found at %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialResourcesPath));
+ potentialResourcesPath = fallbackDir();
+ }
+ }
+
+ return potentialResourcesPath;
+#endif
+}
} // namespace
base::FilePath WebEngineLibraryInfo::getPath(int key)
@@ -232,11 +259,11 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
QString directory;
switch (key) {
case QT_RESOURCES_PAK:
- return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources.pak"));
+ return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources.pak"));
case QT_RESOURCES_100P_PAK:
- return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources_100p.pak"));
+ return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources_100p.pak"));
case QT_RESOURCES_200P_PAK:
- return toFilePath(libraryDataPath() % QLatin1String("/qtwebengine_resources_200p.pak"));
+ return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources_200p.pak"));
case base::FILE_EXE:
case content::CHILD_PROCESS_EXE:
return toFilePath(subProcessPath());