Chromium Code Reviews| Index: chrome/browser/user_data_dir_extractor.cc |
| diff --git a/chrome/browser/user_data_dir_extractor.cc b/chrome/browser/user_data_dir_extractor.cc |
| index 3c7e9cbd1166f4fbd1194a6da026149f6993b2af..e2d17e96e79fe51f42d2d6e4e75158719351879e 100644 |
| --- a/chrome/browser/user_data_dir_extractor.cc |
| +++ b/chrome/browser/user_data_dir_extractor.cc |
| @@ -94,17 +94,24 @@ base::FilePath GetUserDataDir(const content::MainFunctionParams& parameters) { |
| #endif |
| // If the directory does not exist and cannot be created, prompt the user. |
| - if (!user_data_dir.empty() && |
| + const bool specified_directory_was_invalid = !user_data_dir.empty() && |
| !PathService::OverrideAndCreateIfNeeded(chrome::DIR_USER_DATA, |
| - user_data_dir, chrome::ProcessNeedsProfileDir(process_type))) { |
| + user_data_dir, chrome::ProcessNeedsProfileDir(process_type)); |
| + if (specified_directory_was_invalid) |
| ShowUserDataDirWarning(user_data_dir); |
| - } |
| // Getting the user data directory can fail if the directory isn't creatable. |
| // ProcessSingleton needs a real user data directory on Mac/Linux, so it's |
| // better to fail here than fail mysteriously elsewhere. |
| CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) |
| << "Must be able to get user data directory!"; |
| + |
| + // Append the fallback user data directory to the commandline. Otherwise, |
| + // child or service processes will attempt to use the invalid directory. |
| + if (specified_directory_was_invalid) |
| + CommandLine::ForCurrentProcess()->AppendSwitchPath(switches::kUserDataDir, |
|
Vitaly Buka (NO REVIEWS)
2014/02/20 21:28:05
actually you just did that
|
| + user_data_dir); |
| + |
| return user_data_dir; |
| } |