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

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

Issue 711113004: original (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile fix Created 6 years, 1 month 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
« 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 "base/strings/string_util.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
8 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
9 #include "tools/gn/output_file.h" 10 #include "tools/gn/output_file.h"
10 #include "tools/gn/string_utils.h" 11 #include "tools/gn/string_utils.h"
11 12
12 PathOutput::PathOutput(const SourceDir& current_dir, EscapingMode escaping) 13 PathOutput::PathOutput(const SourceDir& current_dir,
14 const base::StringPiece& source_root,
15 EscapingMode escaping)
13 : current_dir_(current_dir) { 16 : current_dir_(current_dir) {
14 CHECK(current_dir.is_source_absolute()) 17 inverse_current_dir_ = RebasePath("//", current_dir, source_root);
15 << "Currently this only supports writing to output directories inside " 18 if (!EndsWithSlash(inverse_current_dir_))
16 "the source root. There needs to be some tweaks to PathOutput to make " 19 inverse_current_dir_.push_back('/');
17 "doing this work correctly.";
18 inverse_current_dir_ = InvertDir(current_dir_);
19
20 options_.mode = escaping; 20 options_.mode = escaping;
21 } 21 }
22 22
23 PathOutput::~PathOutput() { 23 PathOutput::~PathOutput() {
24 } 24 }
25 25
26 void PathOutput::WriteFile(std::ostream& out, const SourceFile& file) const { 26 void PathOutput::WriteFile(std::ostream& out, const SourceFile& file) const {
27 WritePathStr(out, file.value()); 27 WritePathStr(out, file.value());
28 } 28 }
29 29
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
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