Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2127)

Unified Diff: chrome/browser/profile.cc

Issue 18630: Adds a command line switch to allow the user to specify the location... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | chrome/common/chrome_switches.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profile.cc
===================================================================
--- chrome/browser/profile.cc (revision 8504)
+++ chrome/browser/profile.cc (working copy)
@@ -493,6 +493,33 @@
std::wstring cookie_path = GetPath();
file_util::AppendToPath(&cookie_path, chrome::kCookieFilename);
std::wstring cache_path = GetPath();
+
+ // Override the cache location if specified so
rvargas (doing something else) 2009/01/27 03:55:20 nit: Each comment has to be a complete sentence (a
+ const std::wstring user_cache_dir(
+ CommandLine::ForCurrentProcess()->GetSwitchValue(
rvargas (doing something else) 2009/01/27 03:55:20 nit: wrong indentation. See http://dev.chromium.or
+ switches::kDiskCacheLocation));
+ if (!user_cache_dir.empty()) {
+ // Create the directory if necessary. The browser needs it to
+ // exist to populate it.
+ if (file_util::DirectoryExists(user_cache_dir) ||
rvargas (doing something else) 2009/01/27 03:55:20 Remove all the code that creates the folder. That
+ file_util::CreateDirectory(user_cache_dir)) {
+ // This last check reflects the real need - we need a directory
+ // that we can add content to
+ if (file_util::PathIsWritable(user_cache_dir)) {
+ cache_path = user_cache_dir;
+ } else {
+ // Failing silently is the idea here, since this functionality is
+ // simply not important. If the user has specified an unusable
+ // path, the user can figure out how to make it work. If he cannot,
+ // he is probably not the kind of user who would care about moving
+ // the cache anyway. Command line options will eventually have
+ // to be documented somewhere, and then we can document the
+ // condition that the path must exist or its immediate parent
+ // must be writable.
+ }
+ }
+ }
+
file_util::AppendToPath(&cache_path, chrome::kCacheDirname);
request_context_ = ChromeURLRequestContext::CreateOriginal(
this, cookie_path, cache_path);
@@ -511,6 +538,7 @@
DCHECK(request_context_->cookie_store());
}
rvargas (doing something else) 2009/01/27 03:55:20 nit: remove
+
return request_context_;
}
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | chrome/common/chrome_switches.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698