blob: 8626d8afd2625078ddf54475c76cd41717464b0c [file] [log] [blame]
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CRASH_REPORTER_PATHS_H_
#define CRASH_REPORTER_PATHS_H_
#include <base/files/file_path.h>
#include <base/strings/string_piece.h>
namespace paths {
// The base directory where we keep various state flags.
constexpr char kSystemRunStateDirectory[] = "/run/crash_reporter";
// File whose existence indicates this is a developer image.
constexpr char kLeaveCoreFile[] = "/root/.leave_core";
// Base name of file whose existence indicates a crash test is currently
// running.
constexpr char kCrashTestInProgress[] = "crash-test-in-progress";
// Gets a FilePath from the given path. A prefix will be added if the prefix is
// set with SetPrefixForTesting().
base::FilePath Get(base::StringPiece file_path);
// Gets a FilePath from the given directory and the base name. A prefix will be
// added if the prefix is set with SetPrefixForTesting().
base::FilePath GetAt(base::StringPiece directory, base::StringPiece base_name);
// Sets a prefix that'll be added when Get() is called, for unit testing.
// For example, if "/tmp" is set as the prefix, Get("/run/foo") will return
// "/tmp/run/foo". Passing "" will reset the prefix.
void SetPrefixForTesting(const base::FilePath& prefix);
} // namespace paths
#endif // CRASH_REPORTER_PATHS_H_