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.
5 #include "chromecast/crash/linux/dummy_minidump_generator.h"
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/logging.h"
11 namespace chromecast
{
13 DummyMinidumpGenerator::DummyMinidumpGenerator(
14 const std::string
& existing_minidump_path
)
15 : existing_minidump_path_(existing_minidump_path
) {
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";
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() << " "
37 } // namespace chromecast