• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 "gn/input_file.h"
6 
7 #include "base/files/file_util.h"
8 
InputFile(const SourceFile & name)9 InputFile::InputFile(const SourceFile& name)
10     : name_(name), dir_(name_.GetDir()) {}
11 
12 InputFile::~InputFile() = default;
13 
SetContents(const std::string & c)14 void InputFile::SetContents(const std::string& c) {
15   contents_loaded_ = true;
16   contents_ = c;
17 }
18 
Load(const base::FilePath & system_path)19 bool InputFile::Load(const base::FilePath& system_path) {
20   if (base::ReadFileToString(system_path, &contents_)) {
21     contents_loaded_ = true;
22     physical_name_ = system_path;
23     return true;
24   }
25   return false;
26 }
27