Chromium Code Reviews| Index: tools/gn/path_output.cc |
| diff --git a/tools/gn/path_output.cc b/tools/gn/path_output.cc |
| index 7e739b6edc433d03268d6f1fb8accab3d891ac3a..21140d7f86e75fa47be9dc28b9a3b1e0cbcdf2c8 100644 |
| --- a/tools/gn/path_output.cc |
| +++ b/tools/gn/path_output.cc |
| @@ -75,6 +75,29 @@ void PathOutput::WriteFile(std::ostream& out, const OutputFile& file) const { |
| EscapeStringToStream(out, file.value(), options_); |
| } |
| +void PathOutput::WriteDir(std::ostream& out, |
|
scottmg
2014/07/17 21:57:19
can you add to path_output_unittest.cc for this?
|
| + const OutputFile& file, |
| + DirSlashEnding slash_ending) const { |
| + switch (slash_ending) { |
| + case DIR_INCLUDE_LAST_SLASH: |
| + EscapeStringToStream(out, file.value(), options_); |
| + break; |
| + case DIR_NO_LAST_SLASH: |
| + if (!file.value().empty() && |
| + file.value()[file.value().size() - 1] == '/') { |
| + // Trim trailing slash. |
| + EscapeStringToStream( |
| + out, |
| + base::StringPiece(file.value().data(), file.value().size() - 1), |
| + options_); |
| + } else { |
| + // Doesn't end with a slash, write the whole thing. |
| + EscapeStringToStream(out, file.value(), options_); |
| + } |
| + break; |
| + } |
| +} |
| + |
| void PathOutput::WriteFile(std::ostream& out, |
| const base::FilePath& file) const { |
| // Assume native file paths are always absolute. |