OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromecast/crash/linux/dummy_minidump_generator.h" |
| 6 |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" |
| 10 |
| 11 namespace chromecast { |
| 12 |
| 13 DummyMinidumpGenerator::DummyMinidumpGenerator( |
| 14 const std::string& existing_minidump_path) |
| 15 : existing_minidump_path_(existing_minidump_path) { |
| 16 } |
| 17 |
| 18 bool DummyMinidumpGenerator::Generate(const std::string& minidump_path) { |
| 19 base::FilePath file(existing_minidump_path_); |
| 20 if (!base::PathExists(file)) { |
| 21 LOG(ERROR) << file.value() << " is not a valid file path"; |
| 22 return false; |
| 23 } |
| 24 |
| 25 LOG(INFO) << "Moving minidump from " << existing_minidump_path_ << " to " |
| 26 << minidump_path << " for further uploading."; |
| 27 // Use stdlib call here to avoid potential IO restrictions on this thread. |
| 28 if (rename(file.value().c_str(), minidump_path.c_str()) < 0) { |
| 29 LOG(ERROR) << "Could not move file: " << file.value() << " " |
| 30 << strerror(errno); |
| 31 return false; |
| 32 } |
| 33 |
| 34 return true; |
| 35 } |
| 36 |
| 37 } // namespace chromecast |
OLD | NEW |