Browse Source

Update shared.cpp

Final improvement to Qt WebEngine resources location
master
Manio 8 years ago
committed by GitHub
parent
commit
959ef98726
  1. 70
      shared/shared.cpp

70
shared/shared.cpp

@ -889,28 +889,42 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath
// especially since stuff that is supposed to come from resources actually
// seems to come in libexec in the upstream Qt binary distribution
if (containsHowOften(deploymentInfo.deployedLibraries, "libQt5WebEngineCore")) {
QDir().mkpath(appDirInfo.path + "/resources");
QDir().mkpath(appDirInfo.path + "/libexec");
sourcePath = pluginSourcePath + "/../libexec/QtWebEngineProcess";
destinationPath = pluginDestinationPath + "/../libexec/QtWebEngineProcess";
// Find directories with needed files:
QString qtLibexecPath = qtToBeBundledInfo.value("QT_INSTALL_LIBEXECS");
QString qtDataPath = qtToBeBundledInfo.value("QT_INSTALL_DATA");
QString qtTranslationsPath = qtToBeBundledInfo.value("QT_INSTALL_TRANSLATIONS");
// create destination directories:
QString dstLibexec = appDirInfo.path + "/libexec";
QString dstResources = appDirInfo.path + "/resources";
QString dstTranslations = appDirInfo.path + "/translations";
QDir().mkpath(dstLibexec);
QDir().mkpath(dstResources);
QDir().mkpath(dstTranslations);
// WebEngine executable:
sourcePath = QDir::cleanPath(qtLibexecPath + "/QtWebEngineProcess");
destinationPath = QDir::cleanPath(dstLibexec + "/QtWebEngineProcess");
copyFilePrintStatus(sourcePath, destinationPath);
sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources.pak";
destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources.pak";
// put qt.conf file next to browser process so it can also make use of our local Qt resources
createQtConfForQtWebEngineProcess(dstLibexec);
// Resources:
sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources.pak");
destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources.pak");
copyFilePrintStatus(sourcePath, destinationPath);
sourcePath = pluginSourcePath + "/../resources/qtwebengine_devtools_resources.pak";
destinationPath = pluginDestinationPath + "/../resources/qtwebengine_devtools_resources.pak";
sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_devtools_resources.pak");
destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_devtools_resources.pak");
copyFilePrintStatus(sourcePath, destinationPath);
sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources_100p.pak";
destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources_100p.pak";
sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources_100p.pak");
destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources_100p.pak");
copyFilePrintStatus(sourcePath, destinationPath);
sourcePath = pluginSourcePath + "/../resources/qtwebengine_resources_200p.pak";
destinationPath = pluginDestinationPath + "/../resources/qtwebengine_resources_200p.pak";
sourcePath = QDir::cleanPath(qtDataPath + "/resources/qtwebengine_resources_200p.pak");
destinationPath = QDir::cleanPath(dstResources + "/qtwebengine_resources_200p.pak");
copyFilePrintStatus(sourcePath, destinationPath);
sourcePath = pluginSourcePath + "/../resources/icudtl.dat";
destinationPath = pluginDestinationPath + "/../resources/icudtl.dat";
sourcePath = QDir::cleanPath(qtDataPath + "/resources/icudtl.dat");
destinationPath = QDir::cleanPath(dstResources + "/icudtl.dat");
copyFilePrintStatus(sourcePath, destinationPath);
sourcePath = pluginSourcePath + "/../libexec/qtwebengine_locales"; // TODO: this is actually here ../translations/qtwebengine_locales
destinationPath = pluginDestinationPath + "/../resources/"; // TODO: find where to put it
// Translations:
sourcePath = QDir::cleanPath(qtTranslationsPath + "/qtwebengine_locales");
destinationPath = QDir::cleanPath(dstTranslations + "/qtwebengine_locales");
recursiveCopy(sourcePath, destinationPath);
}
@ -964,6 +978,30 @@ void createQtConf(const QString &appDirPath)
}
}
void createQtConfForQtWebEngineProcess(const QString &appDirPath)
{
QByteArray contents = "# Generated by linuxdeployqt\n"
"# https://github.com/probonopd/linuxdeployqt/\n"
"[Paths]\n"
"Prefix = ../\n";
QString filePath = appDirPath + "/";
QString fileName = filePath + "qt.conf";
QDir().mkpath(filePath);
QFile qtconf(fileName);
if (qtconf.exists() && !alwaysOwerwriteEnabled) {
LogWarning() << fileName << "already exists, will not overwrite.";
return;
}
qtconf.open(QIODevice::WriteOnly);
if (qtconf.write(contents) != -1) {
LogNormal() << "Created configuration file for Qt WebEngine process:" << fileName;
LogNormal() << "This file sets the prefix option to parent directory of browser process executable";
}
}
void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo)
{
AppDirInfo applicationBundle;

Loading…
Cancel
Save