Commit f5ec2828 authored by Michael Brüning's avatar Michael Brüning
Browse files

Add a fallback for QLibraryInfo::DataPath as well.


This should remove the necessity to have a qt.conf file for deployed
Windows applications.

Also, be consistent about three dots in the messages that get printed
when trying fallback directories.

Task-number: QTBUG-45614
Change-Id: If46c93a0e8f150b91cff188517187a58edff9144
Reviewed-by: default avatarAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Showing with 25 additions and 7 deletions
......@@ -188,7 +188,7 @@ QString pluginsPath()
potentialPluginsPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine");
}
if (!QFileInfo::exists(potentialPluginsPath)) {
qWarning("Qt WebEngine Plugins directory not found at location %s. Trying fallback directory. Plugins as for example video codecs MAY NOT work.", qPrintable(potentialPluginsPath));
qWarning("Qt WebEngine Plugins directory not found at location %s. Trying fallback directory... Plugins as for example video codecs MAY NOT work.", qPrintable(potentialPluginsPath));
potentialPluginsPath = fallbackDir();
}
}
......@@ -212,7 +212,7 @@ QString localesPath()
potentialLocalesPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine_locales");
}
if (!QFileInfo::exists(potentialLocalesPath)) {
qWarning("Qt WebEngine locales directory not found at location %s. Trying fallback directory. Translations MAY NOT not be correct.", qPrintable(potentialLocalesPath));
qWarning("Qt WebEngine locales directory not found at location %s. Trying fallback directory... Translations MAY NOT not be correct.", qPrintable(potentialLocalesPath));
potentialLocalesPath = fallbackDir();
}
}
......@@ -221,6 +221,28 @@ QString localesPath()
#endif
}
QString libraryDataPath()
{
#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
return getResourcesPath(frameworkBundle());
#else
static bool initialized = false;
static QString potentialDataPath = location(QLibraryInfo::DataPath);
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(potentialDataPath)) {
qWarning("Qt WebEngine data directory not found at location %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialDataPath));
potentialDataPath = fallbackDir();
}
}
return potentialDataPath;
#endif
}
} // namespace
base::FilePath WebEngineLibraryInfo::getPath(int key)
......@@ -248,11 +270,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
break;
case base::DIR_QT_LIBRARY_DATA:
#if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD)
return toFilePath(getResourcesPath(frameworkBundle()));
#else
return toFilePath(location(QLibraryInfo::DataPath));
#endif
return toFilePath(libraryDataPath());
case content::DIR_MEDIA_LIBS:
return toFilePath(pluginsPath());
case ui::DIR_LOCALES:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment