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

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: tests 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/path_output_unittest.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,
79 const OutputFile& file,
80 DirSlashEnding slash_ending) const {
81 DCHECK(file.value().empty() ||
82 file.value()[file.value().size() - 1] == '/');
83
84 switch (slash_ending) {
85 case DIR_INCLUDE_LAST_SLASH:
86 EscapeStringToStream(out, file.value(), options_);
87 break;
88 case DIR_NO_LAST_SLASH:
89 if (!file.value().empty() &&
90 file.value()[file.value().size() - 1] == '/') {
91 // Trim trailing slash.
92 EscapeStringToStream(
93 out,
94 base::StringPiece(file.value().data(), file.value().size() - 1),
95 options_);
96 } else {
97 // Doesn't end with a slash, write the whole thing.
98 EscapeStringToStream(out, file.value(), options_);
99 }
100 break;
101 }
102 }
103
78 void PathOutput::WriteFile(std::ostream& out, 104 void PathOutput::WriteFile(std::ostream& out,
79 const base::FilePath& file) const { 105 const base::FilePath& file) const {
80 // Assume native file paths are always absolute. 106 // Assume native file paths are always absolute.
81 EscapeStringToStream(out, FilePathToUTF8(file), options_); 107 EscapeStringToStream(out, FilePathToUTF8(file), options_);
82 } 108 }
83 109
84 void PathOutput::WriteSourceRelativeString( 110 void PathOutput::WriteSourceRelativeString(
85 std::ostream& out, 111 std::ostream& out,
86 const base::StringPiece& str) const { 112 const base::StringPiece& str) const {
87 if (options_.mode == ESCAPE_NINJA_COMMAND) { 113 if (options_.mode == ESCAPE_NINJA_COMMAND) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // it's system-absolute. 147 // it's system-absolute.
122 #if defined(OS_WIN) 148 #if defined(OS_WIN)
123 // On Windows, trim the leading slash, since the input for absolute 149 // On Windows, trim the leading slash, since the input for absolute
124 // paths will look like "/C:/foo/bar.txt". 150 // paths will look like "/C:/foo/bar.txt".
125 EscapeStringToStream(out, str.substr(1), options_); 151 EscapeStringToStream(out, str.substr(1), options_);
126 #else 152 #else
127 EscapeStringToStream(out, str, options_); 153 EscapeStringToStream(out, str, options_);
128 #endif 154 #endif
129 } 155 }
130 } 156 }
OLDNEW
« no previous file with comments | « tools/gn/path_output.h ('k') | tools/gn/path_output_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698