| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "tools/gn/output_file.h" | 5 #include "tools/gn/output_file.h" |
| 6 | 6 |
| 7 #include "tools/gn/filesystem_utils.h" | 7 #include "tools/gn/filesystem_utils.h" |
| 8 #include "tools/gn/source_file.h" | 8 #include "tools/gn/source_file.h" |
| 9 | 9 |
| 10 OutputFile::OutputFile() : value_() { | 10 OutputFile::OutputFile() : value_() { |
| 11 } | 11 } |
| 12 | 12 |
| 13 OutputFile::OutputFile(const base::StringPiece& str) | 13 OutputFile::OutputFile(std::string&& v) |
| 14 : value_(str.data(), str.size()) { | 14 : value_(v) { |
| 15 } |
| 16 |
| 17 OutputFile::OutputFile(const std::string& v) |
| 18 : value_(v) { |
| 15 } | 19 } |
| 16 | 20 |
| 17 OutputFile::OutputFile(const BuildSettings* build_settings, | 21 OutputFile::OutputFile(const BuildSettings* build_settings, |
| 18 const SourceFile& source_file) | 22 const SourceFile& source_file) |
| 19 : value_(RebasePath(source_file.value(), | 23 : value_(RebasePath(source_file.value(), |
| 20 build_settings->build_dir(), | 24 build_settings->build_dir(), |
| 21 build_settings->root_path_utf8())) { | 25 build_settings->root_path_utf8())) { |
| 22 } | 26 } |
| 23 | 27 |
| 24 OutputFile::~OutputFile() { | 28 OutputFile::~OutputFile() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 if (!value_.empty()) { | 42 if (!value_.empty()) { |
| 39 // Empty means the root build dir. Otherwise, we expect it to end in a | 43 // Empty means the root build dir. Otherwise, we expect it to end in a |
| 40 // slash. | 44 // slash. |
| 41 DCHECK(value_[value_.size() - 1] == '/'); | 45 DCHECK(value_[value_.size() - 1] == '/'); |
| 42 } | 46 } |
| 43 std::string path = build_settings->build_dir().value(); | 47 std::string path = build_settings->build_dir().value(); |
| 44 path.append(value_); | 48 path.append(value_); |
| 45 NormalizePath(&path); | 49 NormalizePath(&path); |
| 46 return SourceDir(path); | 50 return SourceDir(path); |
| 47 } | 51 } |
| OLD | NEW |