| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 78 void PathOutput::WriteFiles(std::ostream& out, |
| 79 const std::vector<OutputFile>& files) const { | 79 const std::vector<OutputFile>& files) const { |
| 80 for (size_t i = 0; i < files.size(); i++) { | 80 for (const auto& file : files) { |
| 81 out << " "; | 81 out << " "; |
| 82 WriteFile(out, files[i]); | 82 WriteFile(out, file); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 void PathOutput::WriteDir(std::ostream& out, | 86 void PathOutput::WriteDir(std::ostream& out, |
| 87 const OutputFile& file, | 87 const OutputFile& file, |
| 88 DirSlashEnding slash_ending) const { | 88 DirSlashEnding slash_ending) const { |
| 89 DCHECK(file.value().empty() || | 89 DCHECK(file.value().empty() || |
| 90 file.value()[file.value().size() - 1] == '/'); | 90 file.value()[file.value().size() - 1] == '/'); |
| 91 | 91 |
| 92 switch (slash_ending) { | 92 switch (slash_ending) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // it's system-absolute. | 155 // it's system-absolute. |
| 156 #if defined(OS_WIN) | 156 #if defined(OS_WIN) |
| 157 // On Windows, trim the leading slash, since the input for absolute | 157 // On Windows, trim the leading slash, since the input for absolute |
| 158 // paths will look like "/C:/foo/bar.txt". | 158 // paths will look like "/C:/foo/bar.txt". |
| 159 EscapeStringToStream(out, str.substr(1), options_); | 159 EscapeStringToStream(out, str.substr(1), options_); |
| 160 #else | 160 #else |
| 161 EscapeStringToStream(out, str, options_); | 161 EscapeStringToStream(out, str, options_); |
| 162 #endif | 162 #endif |
| 163 } | 163 } |
| 164 } | 164 } |
| OLD | NEW |