summaryrefslogtreecommitdiffstats
path: root/base/path_service.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 22:59:59 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 22:59:59 +0000
commit07dc5ffd9a5d10d55e2299651fe7a826d7fd7aba (patch)
treeb70386669cadfae6e152f96afbfbd6129aca1950 /base/path_service.cc
parentb896d838926f0b8defa231665bae020b11a3dd7f (diff)
downloadchromium_src-07dc5ffd9a5d10d55e2299651fe7a826d7fd7aba.zip
chromium_src-07dc5ffd9a5d10d55e2299651fe7a826d7fd7aba.tar.gz
chromium_src-07dc5ffd9a5d10d55e2299651fe7a826d7fd7aba.tar.bz2
POSIX: Make --user-data-dir work when it doesn't exist.
Previously, --user-data-dir called PathService::Override which called AbsolutePath. On POSIX, this calls realpath and fails if the given path doesn't actually exist. We need to do this on Windows because we change the current directory in order to load plugins (at least). However, on POSIX we shouldn't ever change cwd. So, on POSIX, don't try to make the user-data-dir absolute. TEST=On POSIX, start chrome with --user-data-dir=/tmp/xyz (where xyz is a directory which doesn't exist). Once running, check that /tmp/xyz exists and contains the expected files. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14679 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/path_service.cc')
-rw-r--r--base/path_service.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/base/path_service.cc b/base/path_service.cc
index 0c3c3e2..f625c98 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -212,8 +212,13 @@ bool PathService::Override(int key, const std::wstring& path) {
DCHECK(key > base::DIR_CURRENT) << "invalid path key";
std::wstring 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:
if (!file_util::CreateDirectory(file_path))