blob: 74e419d46567f0082a47fdd0d4f5858241210ac1 [file] [log] [blame]
[email protected]96ea63d2013-07-30 10:17:071// Copyright (c) 2013 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 "tools/gn/input_file.h"
6
thestig1ecdcf42014-09-12 05:09:147#include "base/files/file_util.h"
[email protected]96ea63d2013-07-30 10:17:078
9InputFile::InputFile(const SourceFile& name)
10 : name_(name),
11 dir_(name_.GetDir()),
12 contents_loaded_(false) {
13}
14
15InputFile::~InputFile() {
16}
17
18void InputFile::SetContents(const std::string& c) {
19 contents_loaded_ = true;
20 contents_ = c;
21}
22
23bool InputFile::Load(const base::FilePath& system_path) {
[email protected]82f84b92013-08-30 18:23:5024 if (base::ReadFileToString(system_path, &contents_)) {
[email protected]96ea63d2013-07-30 10:17:0725 contents_loaded_ = true;
[email protected]93c19fd22013-08-06 19:34:4426 physical_name_ = system_path;
[email protected]96ea63d2013-07-30 10:17:0727 return true;
28 }
29 return false;
30}
31