diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-07-04 15:19:45 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-07-05 07:18:59 +0000 |
commit | 22816bbca678178804386d6eea6e57b2a0a647eb (patch) | |
tree | 2b2eab6671f5e4c610c4cd34ec921918b7f78f79 /src | |
parent | 2ca27f265cc46e0409e9af873f600644e9c042d3 (diff) |
windeployqt: Make --no-translations work for QtWebEngine
The --no-translations option was deliberately ignored for QtWebEngine,
because of crashes when translations were missing. The crashes have been
fixed, but QtWebEngine still expects at least one translation file.
Otherwise it will warn in the debug log.
Now, when passing --no-translations only the en-US.pak translation file
will be deployed.
Task-number: QTBUG-51658
Change-Id: I767cf74c728e51bed30a94c47948f27f9b801999
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/windeployqt/main.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/windeployqt/main.cpp b/src/windeployqt/main.cpp index 3f15591f7..928e50931 100644 --- a/src/windeployqt/main.cpp +++ b/src/windeployqt/main.cpp @@ -1576,10 +1576,26 @@ static bool deployWebEngineCore(const QMap<QString, QString> &qmakeVariables, << QDir::toNativeSeparators(translations.absoluteFilePath()) << '.'; return true; } - // Missing translations may cause crashes, ignore --no-translations. - return createDirectory(options.translationsDirectory, errorMessage) - && updateFile(translations.absoluteFilePath(), options.translationsDirectory, - options.updateFileFlags, options.json, errorMessage); + if (options.translations) { + // Copy the whole translations directory. + return createDirectory(options.translationsDirectory, errorMessage) + && updateFile(translations.absoluteFilePath(), options.translationsDirectory, + options.updateFileFlags, options.json, errorMessage); + } else { + // Translations have been turned off, but QtWebEngine needs at least one. + const QFileInfo enUSpak(translations.filePath() + QStringLiteral("/en-US.pak")); + if (!enUSpak.exists()) { + std::wcerr << "Warning: Cannot find " + << QDir::toNativeSeparators(enUSpak.absoluteFilePath()) << ".\n"; + return true; + } + const QString webEngineTranslationsDir = options.translationsDirectory + QLatin1Char('/') + + translations.fileName(); + if (!createDirectory(webEngineTranslationsDir, errorMessage)) + return false; + return updateFile(enUSpak.absoluteFilePath(), webEngineTranslationsDir, + options.updateFileFlags, options.json, errorMessage); + } } int main(int argc, char **argv) |