From 07dc5ffd9a5d10d55e2299651fe7a826d7fd7aba Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Mon, 27 Apr 2009 22:59:59 +0000 Subject: 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 --- base/path_service.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'base/path_service.cc') 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)) -- cgit v1.1