mirror of
https://github.com/electron/electron.git
synced 2026-01-26 07:48:08 -05:00
DRY up temp directory logging
This commit is contained in:
@@ -36,7 +36,10 @@ void CrashReporter::Start(const std::string& product_name,
|
||||
}
|
||||
|
||||
bool CrashReporter::GetTempDirectory(base::FilePath* path) {
|
||||
return PathService::Get(base::DIR_TEMP, path);
|
||||
bool success = PathService::Get(base::DIR_TEMP, path);
|
||||
if (!success)
|
||||
LOG(ERROR) << "Cannot get temp directory";
|
||||
return success;
|
||||
}
|
||||
|
||||
bool CrashReporter::GetCrashesDirectory(
|
||||
|
||||
@@ -79,10 +79,8 @@ void CrashReporterLinux::SetUploadParameters() {
|
||||
|
||||
void CrashReporterLinux::EnableCrashDumping(const std::string& product_name) {
|
||||
base::FilePath dumps_path;
|
||||
if (!GetCrashesDirectory(&dumps_path)) {
|
||||
LOG(ERROR) << "Cannot get temp directory";
|
||||
if (!GetCrashesDirectory(&dumps_path))
|
||||
return;
|
||||
}
|
||||
|
||||
base::CreateDirectory(dumps_path);
|
||||
|
||||
|
||||
@@ -34,15 +34,13 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
|
||||
bool auto_submit,
|
||||
bool skip_system_crash_handler) {
|
||||
// check whether crashpad has been initialized.
|
||||
// Only need to initilize once.
|
||||
// Only need to initialize once.
|
||||
if (simple_string_dictionary_)
|
||||
return;
|
||||
|
||||
base::FilePath database_path;
|
||||
if (!GetCrashesDirectory(product_name, &database_path)) {
|
||||
LOG(ERROR) << "Cannot get temp directory";
|
||||
if (!GetCrashesDirectory(product_name, &database_path))
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_browser_) {
|
||||
@autoreleasepool {
|
||||
|
||||
@@ -154,10 +154,8 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
|
||||
skip_system_crash_handler_ = skip_system_crash_handler;
|
||||
|
||||
base::FilePath temp_dir;
|
||||
if (!GetTempDirectory(&temp_dir)) {
|
||||
LOG(ERROR) << "Cannot get temp directory";
|
||||
if (!GetTempDirectory(&temp_dir))
|
||||
return;
|
||||
}
|
||||
|
||||
base::string16 pipe_name = base::ReplaceStringPlaceholders(
|
||||
kPipeNameFormat, base::UTF8ToUTF16(product_name), NULL);
|
||||
|
||||
Reference in New Issue
Block a user