summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@theqtcompany.com>2015-04-16 14:45:20 +0200
committerMichael BrĂ¼ning <michael.bruning@theqtcompany.com>2015-04-16 13:41:40 +0000
commitf5ec28285ab7f71d6d75af963ae499603da6630e (patch)
treef65d45e63c8b280fa906de3269e5a717b7750eed
parent22090ad2a931847b988eaeba411012ab490432da (diff)
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: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
-rw-r--r--src/core/web_engine_library_info.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 573e1631..17f6b2a0 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -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: