diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-12-15 12:21:17 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-01-07 13:40:18 +0100 |
commit | daaa7a9c208671b7b450cf292569fa2f486850fe (patch) | |
tree | 4fab68c549f94655496d3e9ac3b740e7f5285784 | |
parent | 54e05945b0ec4328b9d56b3b6a9886fc24ad3e6a (diff) |
Do not use QDir::separator()
Build all paths Qt-style using / separators, and only convert it when
converted to Chromium types.
Change-Id: I181be6edb903f38e1772bcd324972d1d4e6672fc
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
-rw-r--r-- | src/core/browser_context_adapter.cpp | 8 | ||||
-rw-r--r-- | src/core/browser_context_qt.cpp | 4 | ||||
-rw-r--r-- | src/core/type_conversion.h | 3 | ||||
-rw-r--r-- | src/core/url_request_context_getter_qt.cpp | 6 | ||||
-rw-r--r-- | src/core/web_engine_library_info.cpp | 10 |
5 files changed, 16 insertions, 15 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp index 133dd688a..edf1d2dbc 100644 --- a/src/core/browser_context_adapter.cpp +++ b/src/core/browser_context_adapter.cpp @@ -54,9 +54,9 @@ namespace { inline QString buildLocationFromStandardPath(const QString &standardPath, const QString &name) { QString location = standardPath; if (location.isEmpty()) - location = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName(); + location = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); - location.append(QDir::separator() % QLatin1String("QtWebEngine") % QDir::separator() % name); + location.append(QLatin1String("/QtWebEngine/") % name); return location; } } @@ -170,7 +170,7 @@ QString BrowserContextAdapter::cookiesPath() const return QString(); QString basePath = dataPath(); if (!basePath.isEmpty()) - return basePath % QDir::separator() % QLatin1String("Coookies"); + return basePath % QLatin1String("/Coookies"); return QString(); } @@ -180,7 +180,7 @@ QString BrowserContextAdapter::httpCachePath() const return QString(); QString basePath = cachePath(); if (!basePath.isEmpty()) - return basePath % QDir::separator() % QLatin1String("Cache"); + return basePath % QLatin1String("/Cache"); return QString(); } diff --git a/src/core/browser_context_qt.cpp b/src/core/browser_context_qt.cpp index e2cc8851b..9337b6b6b 100644 --- a/src/core/browser_context_qt.cpp +++ b/src/core/browser_context_qt.cpp @@ -61,12 +61,12 @@ BrowserContextQt::~BrowserContextQt() base::FilePath BrowserContextQt::GetPath() const { - return base::FilePath(toFilePathString(m_adapter->dataPath())); + return toFilePath(m_adapter->dataPath()); } base::FilePath BrowserContextQt::GetCachePath() const { - return base::FilePath(toFilePathString(m_adapter->cachePath())); + return toFilePath(m_adapter->cachePath()); } bool BrowserContextQt::IsOffTheRecord() const diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index f88e5dd21..781023b7c 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -39,6 +39,7 @@ #include <QColor> #include <QDateTime> +#include <QDir> #include <QMatrix4x4> #include <QRect> #include <QString> @@ -142,7 +143,7 @@ inline base::Time toTime(const QDateTime &dateTime) { inline base::FilePath::StringType toFilePathString(const QString &str) { #if defined(OS_WIN) - return str.toStdWString(); + return QDir::toNativeSeparators(str).toStdWString(); #else return str.toStdString(); #endif diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp index 0d72845b5..5d32ef470 100644 --- a/src/core/url_request_context_getter_qt.cpp +++ b/src/core/url_request_context_getter_qt.cpp @@ -177,7 +177,7 @@ void URLRequestContextGetterQt::generateCookieStore() case BrowserContextAdapter::AllowPersistentCookies: cookieStore = content::CreateCookieStore(content::CookieStoreConfig( - base::FilePath(toFilePathString(m_browserContext->cookiesPath())), + toFilePath(m_browserContext->cookiesPath()), content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES, NULL, NULL) ); @@ -185,7 +185,7 @@ void URLRequestContextGetterQt::generateCookieStore() case BrowserContextAdapter::ForcePersistentCookies: cookieStore = content::CreateCookieStore(content::CookieStoreConfig( - base::FilePath(toFilePathString(m_browserContext->cookiesPath())), + toFilePath(m_browserContext->cookiesPath()), content::CookieStoreConfig::RESTORED_SESSION_COOKIES, NULL, NULL) ); @@ -240,7 +240,7 @@ void URLRequestContextGetterQt::generateHttpCache() new net::HttpCache::DefaultBackend( net::DISK_CACHE, net::CACHE_BACKEND_DEFAULT, - base::FilePath(toFilePathString(m_browserContext->httpCachePath())), + toFilePath(m_browserContext->httpCachePath()), m_browserContext->httpCacheMaxSize(), BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) ); diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 026f4db83..5f597b92b 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -78,7 +78,7 @@ QString location(QLibraryInfo::LibraryLocation path) switch (path) { case QLibraryInfo::TranslationsPath: if (!webEnginePath.isEmpty()) - return webEnginePath % QDir::separator() % QLatin1String("translations"); + return webEnginePath % QLatin1String("/translations"); break; case QLibraryInfo::DataPath: if (!webEnginePath.isEmpty()) @@ -138,7 +138,7 @@ QString subProcessPath() % QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME)); #else static QString processPath (location(QLibraryInfo::LibraryExecutablesPath) - % QDir::separator() % processBinary); + % QLatin1Char('/') % processBinary); #endif if (!initialized) { // Allow overriding at runtime for the time being. @@ -147,7 +147,7 @@ QString subProcessPath() processPath = QString::fromLatin1(fromEnv); if (!QFileInfo(processPath).exists()) { qWarning("QtWebEngineProcess not found at location %s. Trying fallback path...", qPrintable(processPath)); - processPath = QCoreApplication::applicationDirPath() % QDir::separator() % processBinary; + processPath = QCoreApplication::applicationDirPath() % QLatin1Char('/') % processBinary; } if (!QFileInfo(processPath).exists()) qFatal("QtWebEngineProcess not found at location %s. Try setting the QTWEBENGINEPROCESS_PATH environment variable.", qPrintable(processPath)); @@ -162,7 +162,7 @@ QString pluginsPath() #if defined(OS_MACOSX) && defined(QT_MAC_FRAMEWORK_BUILD) return getPath(frameworkBundle()) % QLatin1String("/Libraries"); #else - return location(QLibraryInfo::PluginsPath) % QDir::separator() % QLatin1String("qtwebengine"); + return location(QLibraryInfo::PluginsPath) % QLatin1String("/qtwebengine"); #endif } @@ -176,7 +176,7 @@ QString localesPath() } QString fallbackDir() { - static QString directory = QDir::homePath() % QDir::separator() % QChar::fromLatin1('.') % QCoreApplication::applicationName(); + static QString directory = QDir::homePath() % QLatin1String("/.") % QCoreApplication::applicationName(); return directory; } |