diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-07-16 13:30:59 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-07-22 14:15:46 +0000 |
commit | b3dd299dfec35444ec89e7525dc1eebe2493d9eb (patch) | |
tree | a38ad0854cd1a33fe2164dec5d37c91cd94a3d2e | |
parent | 4d91849b394305dbfbb3bf10ed727d218bf92b70 (diff) | |
download | qtwebengine-b3dd299dfec35444ec89e7525dc1eebe2493d9eb.tar.gz |
Remove misleading warning about WebEngineProcess fallback path
Remove the warning, and make the logic more predicable & in line with the
rest of Qt:
* If QWEBENGINEPROCESS_PATH is set, always use it. Assert if the file is
not there.
* If this is a OS X Framework, only look into QtWebEngineCore.framework,
else
* check QLibraryInfo::LibraryExecutablesPath
* check applicationDirPath()
Change-Id: I820388fbfb9e810314f353c9bbe38a471793aebc
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | src/core/web_engine_library_info.cpp | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 589993026..980e9a39a 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -112,33 +112,43 @@ static QString getResourcesPath(CFBundleRef frameworkBundle) QString subProcessPath() { - static bool initialized = false; + static QString processPath; + if (processPath.isEmpty()) { #if defined(OS_WIN) - static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe")); + const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe"); #else - static QString processBinary (QLatin1String(QTWEBENGINEPROCESS_NAME)); + const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME); #endif + + QStringList candidatePaths; + const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH"); + if (!fromEnv.isEmpty()) { + // Only search in QTWEBENGINEPROCESS_PATH if set + candidatePaths << QString::fromLocal8Bit(fromEnv); + } else { #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) - static QString processPath (getPath(frameworkBundle()) - % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME)); + candidatePaths << getPath(frameworkBundle()) + % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME); #else - static QString processPath (QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) - % QLatin1Char('/') % processBinary); + candidatePaths << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) + % QLatin1Char('/') % processBinary; + candidatePaths << QCoreApplication::applicationDirPath() + % QLatin1Char('/') % processBinary; #endif - if (!initialized) { - // Allow overriding at runtime for the time being. - const QByteArray fromEnv = qgetenv("QTWEBENGINEPROCESS_PATH"); - if (!fromEnv.isEmpty()) - processPath = QString::fromLatin1(fromEnv); - if (!QFileInfo(processPath).exists()) { - qWarning("QtWebEngineProcess not found at location %s. Trying fallback path...", qPrintable(processPath)); - processPath = QCoreApplication::applicationDirPath() % QLatin1Char('/') % processBinary; } - if (!QFileInfo(processPath).exists()) - qFatal("QtWebEngineProcess not found at location %s. Try setting the QTWEBENGINEPROCESS_PATH environment variable.", qPrintable(processPath)); - initialized = true; + + Q_FOREACH (const QString &candidate, candidatePaths) { + if (QFileInfo(candidate).exists()) { + processPath = candidate; + break; + } + } + if (processPath.isEmpty()) + qFatal("Could not find %s", processBinary.toUtf8().constData()); + } + return processPath; } |