From 12dd6ff845656eb625e2ee3d0e73392bc2c61983 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 11 Jan 2016 15:31:05 +0100 Subject: Move ICU data to resources sub-dir Also moves the ICU data from the prefix root to the resources subdir. Change-Id: I1eec6c09a8ff1f87166a9f8a2a010b770198751e Reviewed-by: Joerg Bornemann --- src/core/core_module.pro | 4 ++-- src/core/web_engine_library_info.cpp | 24 ++++++++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/core/core_module.pro b/src/core/core_module.pro index 3ad041d74..b001fef06 100644 --- a/src/core/core_module.pro +++ b/src/core/core_module.pro @@ -72,12 +72,12 @@ icu.files = $$OUT_PWD/$$getConfigDir()/icudtl.dat resources.CONFIG += no_check_exist resources.path = $$[QT_INSTALL_DATA]/resources icu.CONFIG += no_check_exist - icu.path = $$[QT_INSTALL_DATA] + icu.path = $$[QT_INSTALL_DATA]/resources INSTALLS += icu locales resources } !contains(QT_CONFIG, qt_framework): contains(QT_CONFIG, private_tests) { - ICU_TARGET = $$shell_path($$[QT_INSTALL_DATA/get]/icudtl.dat) + ICU_TARGET = $$shell_path($$[QT_INSTALL_DATA/get]/resources/icudtl.dat) ICU_FILE = $$shell_path($$OUT_PWD/$$getConfigDir()/icudtl.dat) icu_rule.target = $$ICU_TARGET unix: icu_rule.commands = if [ -e $$ICU_FILE ] ; then $$QMAKE_COPY $$ICU_FILE $$ICU_TARGET ; fi diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index a3c599208..8ec18c87d 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -202,26 +202,30 @@ QString localesPath() #endif } -QString libraryDataPath() +QString icuDataPath() { #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) return getResourcesPath(frameworkBundle()); #else static bool initialized = false; - static QString potentialDataPath = QLibraryInfo::location(QLibraryInfo::DataPath); + static QString potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath) % QLatin1String("/resources"); if (!initialized) { initialized = true; - if (!QFileInfo::exists(potentialDataPath)) { - qWarning("Qt WebEngine data directory not found at location %s. Trying application directory...", qPrintable(potentialDataPath)); - potentialDataPath = QCoreApplication::applicationDirPath(); + if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) { + qWarning("Qt WebEngine ICU data not found at %s. Trying parent directory...", qPrintable(potentialResourcesPath)); + potentialResourcesPath = QLibraryInfo::location(QLibraryInfo::DataPath); + } + if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) { + qWarning("Qt WebEngine ICU data not found at %s. Trying application directory...", qPrintable(potentialResourcesPath)); + potentialResourcesPath = QCoreApplication::applicationDirPath(); } - if (!QFileInfo::exists(potentialDataPath)) { - qWarning("Qt WebEngine data directory not found at location %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialDataPath)); - potentialDataPath = fallbackDir(); + if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/icudtl.dat"))) { + qWarning("Qt WebEngine ICU data not found at %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialResourcesPath)); + potentialResourcesPath = fallbackDir(); } } - return potentialDataPath; + return potentialResourcesPath; #endif } @@ -278,7 +282,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key) directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); break; case base::DIR_QT_LIBRARY_DATA: - return toFilePath(libraryDataPath()); + return toFilePath(icuDataPath()); case content::DIR_MEDIA_LIBS: return toFilePath(pluginsPath()); case ui::DIR_LOCALES: -- cgit v1.2.1