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

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

Issue 213353004: GN: Move towards only using / on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only generate / in various places Created 6 years, 8 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
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"
11 11
12 PathOutput::PathOutput(const SourceDir& current_dir, 12 PathOutput::PathOutput(const SourceDir& current_dir,
13 EscapingMode escaping, 13 EscapingMode escaping)
14 bool convert_slashes)
15 : current_dir_(current_dir) { 14 : current_dir_(current_dir) {
16 CHECK(current_dir.is_source_absolute()) 15 CHECK(current_dir.is_source_absolute())
17 << "Currently this only supports writing to output directories inside " 16 << "Currently this only supports writing to output directories inside "
18 "the source root. There needs to be some tweaks to PathOutput to make " 17 "the source root. There needs to be some tweaks to PathOutput to make "
19 "doing this work correctly."; 18 "doing this work correctly.";
20 inverse_current_dir_ = InvertDir(current_dir_); 19 inverse_current_dir_ = InvertDir(current_dir_);
21 20
22 options_.mode = escaping; 21 options_.mode = escaping;
23 options_.convert_slashes = convert_slashes;
24 options_.inhibit_quoting = false; 22 options_.inhibit_quoting = false;
25
26 if (convert_slashes)
27 ConvertPathToSystem(&inverse_current_dir_);
28 } 23 }
29 24
30 PathOutput::~PathOutput() { 25 PathOutput::~PathOutput() {
31 } 26 }
32 27
33 void PathOutput::WriteFile(std::ostream& out, const SourceFile& file) const { 28 void PathOutput::WriteFile(std::ostream& out, const SourceFile& file) const {
34 WritePathStr(out, file.value()); 29 WritePathStr(out, file.value());
35 } 30 }
36 31
37 void PathOutput::WriteDir(std::ostream& out, 32 void PathOutput::WriteDir(std::ostream& out,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // it's system-absolute. 126 // it's system-absolute.
132 #if defined(OS_WIN) 127 #if defined(OS_WIN)
133 // On Windows, trim the leading slash, since the input for absolute 128 // On Windows, trim the leading slash, since the input for absolute
134 // paths will look like "/C:/foo/bar.txt". 129 // paths will look like "/C:/foo/bar.txt".
135 EscapeStringToStream(out, str.substr(1), options_); 130 EscapeStringToStream(out, str.substr(1), options_);
136 #else 131 #else
137 EscapeStringToStream(out, str, options_); 132 EscapeStringToStream(out, str, options_);
138 #endif 133 #endif
139 } 134 }
140 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698