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

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

Issue 857163002: Absolute path fixes for gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/label_pattern.h" 5 #include "tools/gn/label_pattern.h"
6 6
7 #include "tools/gn/err.h" 7 #include "tools/gn/err.h"
8 #include "tools/gn/filesystem_utils.h" 8 #include "tools/gn/filesystem_utils.h"
9 #include "tools/gn/value.h" 9 #include "tools/gn/value.h"
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (err->has_error()) 114 if (err->has_error())
115 return LabelPattern(); 115 return LabelPattern();
116 116
117 // Trim off the toolchain for the processing below. 117 // Trim off the toolchain for the processing below.
118 str = str.substr(0, open_paren); 118 str = str.substr(0, open_paren);
119 } 119 }
120 120
121 // Extract path and name. 121 // Extract path and name.
122 base::StringPiece path; 122 base::StringPiece path;
123 base::StringPiece name; 123 base::StringPiece name;
124 size_t colon = str.find(':'); 124 size_t offset = 0;
125 #if defined(OS_WIN)
126 if (IsPathAbsolute(str)) {
brettw 2015/01/20 21:05:00 Ditto
127 // Skip over the drive letter colon.
128 offset = 3;
129 }
130 #endif
131 size_t colon = str.find(':', offset);
125 if (colon == std::string::npos) { 132 if (colon == std::string::npos) {
126 path = base::StringPiece(str); 133 path = base::StringPiece(str);
127 } else { 134 } else {
128 path = str.substr(0, colon); 135 path = str.substr(0, colon);
129 name = str.substr(colon + 1); 136 name = str.substr(colon + 1);
130 } 137 }
131 138
132 // The path can have these forms: 139 // The path can have these forms:
133 // 1. <empty> (use current dir) 140 // 1. <empty> (use current dir)
134 // 2. <non wildcard stuff> (send through directory resolution) 141 // 2. <non wildcard stuff> (send through directory resolution)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 break; 245 break;
239 } 246 }
240 247
241 if (!toolchain_.is_null()) { 248 if (!toolchain_.is_null()) {
242 result.push_back('('); 249 result.push_back('(');
243 result.append(toolchain_.GetUserVisibleName(false)); 250 result.append(toolchain_.GetUserVisibleName(false));
244 result.push_back(')'); 251 result.push_back(')');
245 } 252 }
246 return result; 253 return result;
247 } 254 }
OLDNEW
« tools/gn/label.cc ('K') | « tools/gn/label.cc ('k') | tools/gn/source_dir.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698