Chromium Code Reviews| Index: content/shell/browser/shell_browser_context.cc |
| diff --git a/content/shell/browser/shell_browser_context.cc b/content/shell/browser/shell_browser_context.cc |
| index 65f4801b923a385b74fa8ff53bab720a5810f48d..55dd1017e05f863d2cb39592b1eecdab7ddd4f9d 100644 |
| --- a/content/shell/browser/shell_browser_context.cc |
| +++ b/content/shell/browser/shell_browser_context.cc |
| @@ -75,9 +75,19 @@ void ShellBrowserContext::InitWhileIOAllowed() { |
| ignore_certificate_errors_ = true; |
| if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
| - BrowserContext::Initialize(this, path_); |
| - return; |
| + if (base::DirectoryExists(path_) || base::CreateDirectory(path_)) { |
| + // We need to have an absolute path. |
|
Peter Beverloo
2016/09/29 16:22:53
nit: might be good to document that the PathServic
michaelpg
2016/09/30 03:38:56
Done.
|
| + if (!path_.IsAbsolute()) |
| + path_ = base::MakeAbsoluteFilePath(path_); |
| + if (!path_.empty()) { |
| + BrowserContext::Initialize(this, path_); |
| + return; |
| + } |
| + } else { |
| + LOG(WARNING) << "Unable to create data-path directory: " << path_.value(); |
| + } |
| } |
| + |
| #if defined(OS_WIN) |
| CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); |
| path_ = path_.Append(std::wstring(L"content_shell")); |