| Index: base/path_service.cc
|
| diff --git a/base/path_service.cc b/base/path_service.cc
|
| index 47278c39dff2cba0a99f8b7c47781d3489fdadbb..aabc4961ff351c019536e5af876cf062c64bf9f6 100644
|
| --- a/base/path_service.cc
|
| +++ b/base/path_service.cc
|
| @@ -222,18 +222,27 @@ bool PathService::Get(int key, FilePath* result) {
|
| }
|
|
|
| bool PathService::Override(int key, const FilePath& path) {
|
| + // Just call the full function with true for the value of |create|.
|
| + return Override(key, path, true);
|
| +}
|
| +
|
| +bool PathService::Override(int key, const FilePath& path, bool create) {
|
| PathData* path_data = GetPathData();
|
| DCHECK(path_data);
|
| DCHECK_GT(key, base::DIR_CURRENT) << "invalid path key";
|
|
|
| FilePath file_path = path;
|
|
|
| - // 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-existent path.
|
| - if (!file_util::PathExists(file_path) &&
|
| - !file_util::CreateDirectory(file_path))
|
| - return false;
|
| + // For some locations this will fail if called from inside the sandbox there-
|
| + // fore we protect this call with a flag.
|
| + if (create) {
|
| + // 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-existent 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 gladly crash the browser in CHECK()s if they get a
|
|
|