blob: b81848bc10529a617cfc5faaafa7e4d1d90af53e [file] [log] [blame]
Peter Qiu77517302015-01-08 16:22:16 -08001// Copyright 2015 The Chromium OS 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 "apmanager/file_writer.h"
6
7#include <base/files/file_util.h>
8
9namespace apmanager {
10
11namespace {
12
13base::LazyInstance<FileWriter> g_file_writer
14 = LAZY_INSTANCE_INITIALIZER;
15
16} // namespace
17
18FileWriter::FileWriter() {}
19FileWriter::~FileWriter() {}
20
21FileWriter* FileWriter::GetInstance() {
22 return g_file_writer.Pointer();
23}
24
25bool FileWriter::Write(const std::string& file_name,
26 const std::string& content) {
27 if (base::WriteFile(base::FilePath(file_name),
28 content.c_str(),
29 content.size()) == -1) {
30 return false;
31 }
32 return true;
33}
34
35} // namespace apmanager