Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: tools/gn/path_output.cc

Issue 406453002: Hook up symbol files to the Windows GN build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/gn/path_output.h ('k') | tools/gn/variables.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::WriteDir(std::ostream& out,
scottmg 2014/07/17 21:57:19 can you add to path_output_unittest.cc for this?
79 const OutputFile& file,
80 DirSlashEnding slash_ending) const {
81 switch (slash_ending) {
82 case DIR_INCLUDE_LAST_SLASH:
83 EscapeStringToStream(out, file.value(), options_);
84 break;
85 case DIR_NO_LAST_SLASH:
86 if (!file.value().empty() &&
87 file.value()[file.value().size() - 1] == '/') {
88 // Trim trailing slash.
89 EscapeStringToStream(
90 out,
91 base::StringPiece(file.value().data(), file.value().size() - 1),
92 options_);
93 } else {
94 // Doesn't end with a slash, write the whole thing.
95 EscapeStringToStream(out, file.value(), options_);
96 }
97 break;
98 }
99 }
100
78 void PathOutput::WriteFile(std::ostream& out, 101 void PathOutput::WriteFile(std::ostream& out,
79 const base::FilePath& file) const { 102 const base::FilePath& file) const {
80 // Assume native file paths are always absolute. 103 // Assume native file paths are always absolute.
81 EscapeStringToStream(out, FilePathToUTF8(file), options_); 104 EscapeStringToStream(out, FilePathToUTF8(file), options_);
82 } 105 }
83 106
84 void PathOutput::WriteSourceRelativeString( 107 void PathOutput::WriteSourceRelativeString(
85 std::ostream& out, 108 std::ostream& out,
86 const base::StringPiece& str) const { 109 const base::StringPiece& str) const {
87 if (options_.mode == ESCAPE_NINJA_COMMAND) { 110 if (options_.mode == ESCAPE_NINJA_COMMAND) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // it's system-absolute. 144 // it's system-absolute.
122 #if defined(OS_WIN) 145 #if defined(OS_WIN)
123 // On Windows, trim the leading slash, since the input for absolute 146 // On Windows, trim the leading slash, since the input for absolute
124 // paths will look like "/C:/foo/bar.txt". 147 // paths will look like "/C:/foo/bar.txt".
125 EscapeStringToStream(out, str.substr(1), options_); 148 EscapeStringToStream(out, str.substr(1), options_);
126 #else 149 #else
127 EscapeStringToStream(out, str, options_); 150 EscapeStringToStream(out, str, options_);
128 #endif 151 #endif
129 } 152 }
130 } 153 }
OLDNEW
« no previous file with comments | « tools/gn/path_output.h ('k') | tools/gn/variables.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698