Commit dabdb68e authored by erg@google.com's avatar erg@google.com

Make all paths passed to --user-data-dir absolute.

BUG=24355
TEST=NONE

Review URL: http://codereview.chromium.org/337054

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30284 0039d316-1c4b-4281-b951-d872f2087c98
parent 0a7652c6
......@@ -214,19 +214,20 @@ 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 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, and will glady crash the browser in CHECK()s if they get a
// relative path.
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment