OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/path_output.h" | 5 #include "tools/gn/path_output.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "tools/gn/filesystem_utils.h" | 8 #include "tools/gn/filesystem_utils.h" |
9 #include "tools/gn/output_file.h" | 9 #include "tools/gn/output_file.h" |
10 #include "tools/gn/string_utils.h" | 10 #include "tools/gn/string_utils.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 WritePathStr(out, base::StringPiece(dir.value().data(), | 68 WritePathStr(out, base::StringPiece(dir.value().data(), |
69 dir.value().size() - 1)); | 69 dir.value().size() - 1)); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void PathOutput::WriteFile(std::ostream& out, const OutputFile& file) const { | 73 void PathOutput::WriteFile(std::ostream& out, const OutputFile& file) const { |
74 // Here we assume that the path is already preprocessed. | 74 // Here we assume that the path is already preprocessed. |
75 EscapeStringToStream(out, file.value(), options_); | 75 EscapeStringToStream(out, file.value(), options_); |
76 } | 76 } |
77 | 77 |
| 78 void PathOutput::WriteFiles(std::ostream& out, |
| 79 const std::vector<OutputFile>& files) const { |
| 80 for (size_t i = 0; i < files.size(); i++) { |
| 81 out << " "; |
| 82 WriteFile(out, files[i]); |
| 83 } |
| 84 } |
| 85 |
78 void PathOutput::WriteDir(std::ostream& out, | 86 void PathOutput::WriteDir(std::ostream& out, |
79 const OutputFile& file, | 87 const OutputFile& file, |
80 DirSlashEnding slash_ending) const { | 88 DirSlashEnding slash_ending) const { |
81 DCHECK(file.value().empty() || | 89 DCHECK(file.value().empty() || |
82 file.value()[file.value().size() - 1] == '/'); | 90 file.value()[file.value().size() - 1] == '/'); |
83 | 91 |
84 switch (slash_ending) { | 92 switch (slash_ending) { |
85 case DIR_INCLUDE_LAST_SLASH: | 93 case DIR_INCLUDE_LAST_SLASH: |
86 EscapeStringToStream(out, file.value(), options_); | 94 EscapeStringToStream(out, file.value(), options_); |
87 break; | 95 break; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // it's system-absolute. | 155 // it's system-absolute. |
148 #if defined(OS_WIN) | 156 #if defined(OS_WIN) |
149 // On Windows, trim the leading slash, since the input for absolute | 157 // On Windows, trim the leading slash, since the input for absolute |
150 // paths will look like "/C:/foo/bar.txt". | 158 // paths will look like "/C:/foo/bar.txt". |
151 EscapeStringToStream(out, str.substr(1), options_); | 159 EscapeStringToStream(out, str.substr(1), options_); |
152 #else | 160 #else |
153 EscapeStringToStream(out, str, options_); | 161 EscapeStringToStream(out, str, options_); |
154 #endif | 162 #endif |
155 } | 163 } |
156 } | 164 } |
OLD | NEW |