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

Unified Diff: base/path_service.cc

Issue 337054: Allow non-absolute arguments to --user-data-dir. (Closed)
Patch Set: Created 11 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/path_service.cc
diff --git a/base/path_service.cc b/base/path_service.cc
index 4a4c100a7b006c63f058c36e894064104a8ca14b..844c81841351dfaaab94ec388017c1bbdfc1b648 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -214,19 +214,19 @@ bool PathService::Override(int key, const FilePath& path) {
DCHECK(key > base::DIR_CURRENT) << "invalid path key";
FilePath file_path = path;
-#if defined(OS_WIN)
- // On Windows we switch the current working directory to load plugins (at
- // least). That's not the case on POSIX.
- // Also, on POSIX, AbsolutePath fails if called on a non-existant path.
- if (!file_util::AbsolutePath(&file_path))
- return false;
-#endif
- // make sure the directory exists:
+ // Make sure the directory exists. We need to do this before we make
MAD 2009/10/27 23:22:56 "...before we make translate..."??? Is it just me
+ // translate this to the absolute path because on POSIX, AbsolutePath fails
+ // if called on a non-existant path.
if (!file_util::PathExists(file_path) &&
!file_util::CreateDirectory(file_path))
return false;
+ // We need to have an absolute path, as extensions and plugins don't like
+ // relative paths.
+ if (!file_util::AbsolutePath(&file_path))
+ return false;
+
AutoLock scoped_lock(path_data->lock);
path_data->cache[key] = file_path;
path_data->overrides.insert(key);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698