diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-02-07 15:36:02 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-02-07 16:06:26 +0000 |
commit | 18185684b6c18d68906405c8573df16211a80f98 (patch) | |
tree | 288feb0b55ca2497e6a4466365006c6b19eea7af | |
parent | 685366c9a3d8d967e072c721c64a365ce50bc531 (diff) |
Do not create directories for overridden paths
When overriding Chromium's default paths do not create non-existent
directories anymore. Just print a diagnostic message.
Task-number: QTBUG-54258
Change-Id: Ie642a630ad5b4aebc4e80e3eace7db7489a82907
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | src/core/content_main_delegate_qt.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 095e54caa..84f767ee3 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -154,15 +154,29 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie #define ICU_UTIL_DATA_SHARED 1 #define ICU_UTIL_DATA_STATIC 2 +static void SafeOverridePathImpl(const char *keyName, int key, const base::FilePath &path) +{ + if (path.empty()) + return; + + // Do not create directories for overridden paths. + if (PathService::OverrideAndCreateIfNeeded(key, path, false, false)) + return; + + qWarning("Path override failed for key %s and path '%s'", keyName, path.value().c_str()); +} + +#define SafeOverridePath(KEY, PATH) SafeOverridePathImpl(#KEY, KEY, PATH) + bool ContentMainDelegateQt::BasicStartupComplete(int *exit_code) { - PathService::Override(base::FILE_EXE, WebEngineLibraryInfo::getPath(base::FILE_EXE)); + SafeOverridePath(base::FILE_EXE, WebEngineLibraryInfo::getPath(base::FILE_EXE)); #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE - PathService::Override(base::DIR_QT_LIBRARY_DATA, WebEngineLibraryInfo::getPath(base::DIR_QT_LIBRARY_DATA)); + SafeOverridePath(base::DIR_QT_LIBRARY_DATA, WebEngineLibraryInfo::getPath(base::DIR_QT_LIBRARY_DATA)); #endif - PathService::Override(ui::DIR_LOCALES, WebEngineLibraryInfo::getPath(ui::DIR_LOCALES)); + SafeOverridePath(ui::DIR_LOCALES, WebEngineLibraryInfo::getPath(ui::DIR_LOCALES)); #if defined(ENABLE_SPELLCHECK) - PathService::Override(base::DIR_APP_DICTIONARIES, WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES)); + SafeOverridePath(base::DIR_APP_DICTIONARIES, WebEngineLibraryInfo::getPath(base::DIR_APP_DICTIONARIES)); #endif SetContentClient(new ContentClientQt); return false; |