OLD | NEW |
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Resolve the part of the path that's not the wildcard. | 159 // Resolve the part of the path that's not the wildcard. |
160 if (!path.empty()) { | 160 if (!path.empty()) { |
161 // The non-wildcard stuff better not have a wildcard. | 161 // The non-wildcard stuff better not have a wildcard. |
162 if (path.find('*') != base::StringPiece::npos) { | 162 if (path.find('*') != base::StringPiece::npos) { |
163 *err = Err(value, "Label patterns only support wildcard suffixes.", | 163 *err = Err(value, "Label patterns only support wildcard suffixes.", |
164 "The pattern contained a '*' that wasn't at tne end."); | 164 "The pattern contained a '*' that wasn't at tne end."); |
165 return LabelPattern(); | 165 return LabelPattern(); |
166 } | 166 } |
167 | 167 |
168 // Resolve the non-wildcard stuff. | 168 // Resolve the non-wildcard stuff. |
169 dir = current_dir.ResolveRelativeDir(path); | 169 dir = current_dir.ResolveRelativeDir(path, base::FilePath()); |
170 if (dir.is_null()) { | 170 if (dir.is_null()) { |
171 *err = Err(value, "Label pattern didn't resolve to a dir.", | 171 *err = Err(value, "Label pattern didn't resolve to a dir.", |
172 "The directory name \"" + path.as_string() + "\" didn't\n" | 172 "The directory name \"" + path.as_string() + "\" didn't\n" |
173 "resolve to a directory."); | 173 "resolve to a directory."); |
174 return LabelPattern(); | 174 return LabelPattern(); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 // Resolve the name. At this point, we're doing wildcard matches so the | 178 // Resolve the name. At this point, we're doing wildcard matches so the |
179 // name should either be empty ("foo/*") or a wildcard ("foo:*"); | 179 // name should either be empty ("foo/*") or a wildcard ("foo:*"); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 break; | 238 break; |
239 } | 239 } |
240 | 240 |
241 if (!toolchain_.is_null()) { | 241 if (!toolchain_.is_null()) { |
242 result.push_back('('); | 242 result.push_back('('); |
243 result.append(toolchain_.GetUserVisibleName(false)); | 243 result.append(toolchain_.GetUserVisibleName(false)); |
244 result.push_back(')'); | 244 result.push_back(')'); |
245 } | 245 } |
246 return result; | 246 return result; |
247 } | 247 } |
OLD | NEW |