summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Graham <scottmg@chromium.org>2016-03-11 10:42:14 -0800
committerScott Graham <scottmg@chromium.org>2016-03-11 18:44:15 +0000
commit4a5c529d37e17c3ea7def8aa7de2507a5548d84d (patch)
treebcde86986e1f7f8d534580d337d7f68d9e3ee402
parent8caee064fc5556d606619d0ca2c7f472364f0f3e (diff)
downloadchromium_src-4a5c529d37e17c3ea7def8aa7de2507a5548d84d.zip
chromium_src-4a5c529d37e17c3ea7def8aa7de2507a5548d84d.tar.gz
chromium_src-4a5c529d37e17c3ea7def8aa7de2507a5548d84d.tar.bz2
crashpad win: Ensure database dir exists on first run
Crashpad will only create one level of directory for its database storage. On Windows, the target is %LOCALAPPDATA%\Google\Chrome\User Data\Crashpad. However, on first run when Crashpad is initialized, "User Data" will not yet have been created. We don't want to move Crashpad initialization later in startup, so we instead create the directory if it does not exist. Note that this is calling file_util::CreateDirectory(), rather than CreateDirectoryW() which means the full parent tree will be created, not just the last entry in the path. R=thakis@chromium.org,wfh@chromium.org TEST=remove local user data dir, install chrome, confirm that chrome --process-type=crashpad-handler exists on first run BUG=591504 Review URL: https://codereview.chromium.org/1774573002 Cr-Commit-Position: refs/heads/master@{#379676} (cherry picked from commit 92905ef36a30be9be9041d8ee07ccd6e7ca45d64) Review URL: https://codereview.chromium.org/1790493003 . Cr-Commit-Position: refs/branch-heads/2623@{#613} Cr-Branched-From: 92d77538a86529ca35f9220bd3cd512cbea1f086-refs/heads/master@{#369907}
-rw-r--r--chrome/common/chrome_paths_win.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc
index 37a262c..4713a0a 100644
--- a/chrome/common/chrome_paths_win.cc
+++ b/chrome/common/chrome_paths_win.cc
@@ -11,6 +11,7 @@
#include <shobjidl.h>
#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/win/scoped_co_mem.h"
#include "chrome/common/chrome_constants.h"
@@ -124,6 +125,10 @@ bool GetDefaultCrashDumpLocation(base::FilePath* crash_dir) {
// Windows. See https://crbug.com/564398.
if (!GetDefaultUserDataDirectory(crash_dir))
return false;
+ // We have to make sure the user data dir exists on first run. See
+ // http://crbug.com/591504.
+ if (!PathExists(*crash_dir) && !CreateDirectory(*crash_dir))
+ return false;
*crash_dir = crash_dir->Append(FILE_PATH_LITERAL("Crashpad"));
return true;
}