summaryrefslogtreecommitdiffstats
path: root/src/core/web_engine_library_info.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/web_engine_library_info.cpp')
-rw-r--r--src/core/web_engine_library_info.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 151365693..e71153899 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -57,7 +57,7 @@ static QString getBundlePath(CFBundleRef frameworkBundle)
// The following is a fix for QtWebEngineProcess crashes on OS X 10.7 and before.
// We use it for the other OS X versions as well to make sure it works and because
// the directory structure should be the same.
- if (qApp->applicationName() == QLatin1String(QTWEBENGINEPROCESS_NAME)) {
+ if (qApp->applicationName() == QLatin1String(qWebEngineProcessName())) {
path = QDir::cleanPath(qApp->applicationDirPath() % QLatin1String("/../../../.."));
} else if (frameworkBundle) {
CFURLRef bundleUrl = CFBundleCopyBundleURL(frameworkBundle);
@@ -75,7 +75,7 @@ static QString getResourcesPath(CFBundleRef frameworkBundle)
// The following is a fix for QtWebEngineProcess crashes on OS X 10.7 and before.
// We use it for the other OS X versions as well to make sure it works and because
// the directory structure should be the same.
- if (qApp->applicationName() == QLatin1String(QTWEBENGINEPROCESS_NAME)) {
+ if (qApp->applicationName() == QLatin1String(qWebEngineProcessName())) {
path = getBundlePath(frameworkBundle) % QLatin1String("/Resources");
} else if (frameworkBundle) {
CFURLRef resourcesRelativeUrl = CFBundleCopyResourcesDirectoryURL(frameworkBundle);
@@ -121,9 +121,9 @@ QString subProcessPath()
static QString processPath;
if (processPath.isEmpty()) {
#if defined(Q_OS_WIN)
- const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe");
+ const QString processBinary = QLatin1String(qWebEngineProcessName()) % QLatin1String(".exe");
#else
- const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME);
+ const QString processBinary = QLatin1String(qWebEngineProcessName());
#endif
QStringList candidatePaths;
@@ -133,8 +133,9 @@ QString subProcessPath()
candidatePaths << fromEnv;
} else {
#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
- candidatePaths << getBundlePath(frameworkBundle())
- % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME);
+ candidatePaths << getBundlePath(frameworkBundle()) % QStringLiteral("/Helpers/")
+ % qWebEngineProcessName() % QStringLiteral(".app/Contents/MacOS/")
+ % qWebEngineProcessName();
#else
candidatePaths << QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)
% QLatin1Char('/') % processBinary;
@@ -145,7 +146,7 @@ QString subProcessPath()
% QLatin1Char('/') % processBinary;
}
- for (const QString &candidate : qAsConst(candidatePaths)) {
+ for (const QString &candidate : std::as_const(candidatePaths)) {
if (QFileInfo::exists(candidate)) {
processPath = candidate;
qCDebug(webEngineLibraryInfoLog, "Qt WebEngine process path: %s",
@@ -157,7 +158,7 @@ QString subProcessPath()
QStringList errorMessage;
errorMessage.append(
QStringLiteral("The following paths were searched for Qt WebEngine Process:"));
- for (const QString &candidate : qAsConst(candidatePaths))
+ for (const QString &candidate : std::as_const(candidatePaths))
errorMessage.append(QStringLiteral(" ") % candidate);
errorMessage.append(QStringLiteral("but could not find it."));
if (fromEnv.isEmpty()) {
@@ -207,7 +208,7 @@ QString localesPath()
candidatePaths << fallbackDir();
}
- for (const QString &candidate : qAsConst(candidatePaths)) {
+ for (const QString &candidate : std::as_const(candidatePaths)) {
if (QFileInfo::exists(candidate % QDir::separator() % translationPakFilename)) {
potentialLocalesPath = candidate;
qCDebug(webEngineLibraryInfoLog, "Qt WebEngine locales path: %s",
@@ -220,7 +221,7 @@ QString localesPath()
QStringList warningMessage;
warningMessage.append(
QStringLiteral("The following paths were searched for Qt WebEngine locales:"));
- for (const QString &candidate : qAsConst(candidatePaths))
+ for (const QString &candidate : std::as_const(candidatePaths))
warningMessage.append(QStringLiteral(" ") % candidate);
warningMessage.append(
QStringLiteral(
@@ -275,7 +276,7 @@ QString dictionariesPath()
candidatePaths << libraryDictionariesPath;
}
- for (const QString &candidate : qAsConst(candidatePaths)) {
+ for (const QString &candidate : std::as_const(candidatePaths)) {
if (QFileInfo::exists(candidate)) {
potentialDictionariesPath = candidate;
qCDebug(webEngineLibraryInfoLog, "Qt WebEngine dictionaries path: %s",
@@ -283,6 +284,12 @@ QString dictionariesPath()
break;
}
}
+
+ if (potentialDictionariesPath.isEmpty()) {
+ // return path for error message
+ potentialDictionariesPath = QCoreApplication::applicationDirPath() % QDir::separator()
+ % QLatin1String("qtwebengine_dictionaries");
+ }
}
return potentialDictionariesPath;
@@ -310,7 +317,7 @@ QString resourcesPath()
candidatePaths << fallbackDir();
}
- for (const QString &candidate : qAsConst(candidatePaths)) {
+ for (const QString &candidate : std::as_const(candidatePaths)) {
if (QFileInfo::exists(candidate % QDir::separator() % resourcesPakFilename)) {
potentialResourcesPath = candidate;
qCDebug(webEngineLibraryInfoLog, "Qt WebEngine resources path: %s",
@@ -323,7 +330,7 @@ QString resourcesPath()
QStringList errorMessage;
errorMessage.append(QStringLiteral(
"The following paths were searched for Qt WebEngine resources:"));
- for (const QString &candidate : qAsConst(candidatePaths))
+ for (const QString &candidate : std::as_const(candidatePaths))
errorMessage.append(QStringLiteral(" ") % candidate);
errorMessage.append(QStringLiteral("but could not find any."));
if (fromEnv.isEmpty()) {
@@ -377,6 +384,8 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
case base::DIR_APP_DICTIONARIES:
return toFilePath(dictionariesPath());
#endif
+ case base::DIR_ASSETS:
+ return toFilePath(resourcesPath());
default:
// Note: the path system expects this function to override the default
// behavior. So no need to log an error if we don't support a given