From f9dbcac181bf71467761dff681223c1f03aaa8a6 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 16 May 2017 13:59:25 +0200 Subject: Fix qwebengine_convert_dict to work with macOS framework build The ICU data file in a macOS framework build is located inside the QtWebEngineCore.framework/Resources directory. The dictionary conversion tool looked for the ICU data file only in the installed Qt location directory, which is incorrect, thus leading to a conversion failure. The fix is to check for the data file in the QtWebEngineCore framework directory. Task-number: QTBUG-60707 Change-Id: Ic2325e2b5a5db4e7cbcea3bed92755d5f8b92f95 Reviewed-by: Michal Klocek --- src/tools/qwebengine_convert_dict/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/tools/qwebengine_convert_dict/main.cpp b/src/tools/qwebengine_convert_dict/main.cpp index 61e26c4a3..a86f868b3 100644 --- a/src/tools/qwebengine_convert_dict/main.cpp +++ b/src/tools/qwebengine_convert_dict/main.cpp @@ -107,6 +107,14 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words, return true; } +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) +QString frameworkIcuDataPath() +{ + return QLibraryInfo::location(QLibraryInfo::LibrariesPath) + + QStringLiteral("/QtWebEngineCore.framework/Resources/"); +} +#endif + int main(int argc, char *argv[]) { QTextStream out(stdout); @@ -132,6 +140,14 @@ int main(int argc, char *argv[]) icuDataDir = icuPossibleEnvDataDir; icuDataDirFound = true; } +#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) + // In a macOS Qt framework build, the resources are inside the QtWebEngineCore framework + // Resources directory, rather than in the Qt install location. + else if (QFileInfo::exists(frameworkIcuDataPath())) { + icuDataDir = frameworkIcuDataPath(); + icuDataDirFound = true; + } +#endif // Try to find the ICU data directory in the installed Qt location. else if (QFileInfo::exists(icuDataDir)) { icuDataDirFound = true; -- cgit v1.2.3