diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 23:31:36 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 23:31:36 +0000 |
commit | dabdb68e738bf1a9f0ae51e59c188d0ab784f106 (patch) | |
tree | d6e89c5dd532445dc7c1f92044ee7eb54f8adaa4 /base/path_service.cc | |
parent | 0a7652c67fa96730494fc4db0fee3cf58c62752c (diff) | |
download | chromium_src-dabdb68e738bf1a9f0ae51e59c188d0ab784f106.zip chromium_src-dabdb68e738bf1a9f0ae51e59c188d0ab784f106.tar.gz chromium_src-dabdb68e738bf1a9f0ae51e59c188d0ab784f106.tar.bz2 |
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
Diffstat (limited to 'base/path_service.cc')
-rw-r--r-- | base/path_service.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/base/path_service.cc b/base/path_service.cc index 4a4c100..0e4c6a2 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -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); |