| 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 "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
| 10 #include "tools/gn/value.h" | 10 #include "tools/gn/value.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 size_t offset = 0; | 125 size_t offset = 0; |
| 126 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
| 127 if (IsPathAbsolute(str)) { | 127 if (IsPathAbsolute(str)) { |
| 128 if (str[0] != '/') { | 128 if (str[0] != '/') { |
| 129 *err = Err(value, "Bad absolute path.", | 129 *err = Err(value, "Bad absolute path.", |
| 130 "Absolute paths must be of the form /C:\\ but this is \"" + | 130 "Absolute paths must be of the form /C:\\ but this is \"" + |
| 131 str.as_string() + "\"."); | 131 str.as_string() + "\"."); |
| 132 return LabelPattern(); | 132 return LabelPattern(); |
| 133 } | 133 } |
| 134 if (str.size() > 3 && str[2] == ':' && IsSlash(str[3]) && | 134 if (str.size() > 3 && str[2] == ':' && IsSlash(str[3]) && |
| 135 IsAsciiAlpha(str[1])) { | 135 base::IsAsciiAlpha(str[1])) { |
| 136 // Skip over the drive letter colon. | 136 // Skip over the drive letter colon. |
| 137 offset = 3; | 137 offset = 3; |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 #endif | 140 #endif |
| 141 size_t colon = str.find(':', offset); | 141 size_t colon = str.find(':', offset); |
| 142 if (colon == std::string::npos) { | 142 if (colon == std::string::npos) { |
| 143 path = base::StringPiece(str); | 143 path = base::StringPiece(str); |
| 144 } else { | 144 } else { |
| 145 path = str.substr(0, colon); | 145 path = str.substr(0, colon); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 break; | 257 break; |
| 258 } | 258 } |
| 259 | 259 |
| 260 if (!toolchain_.is_null()) { | 260 if (!toolchain_.is_null()) { |
| 261 result.push_back('('); | 261 result.push_back('('); |
| 262 result.append(toolchain_.GetUserVisibleName(false)); | 262 result.append(toolchain_.GetUserVisibleName(false)); |
| 263 result.push_back(')'); | 263 result.push_back(')'); |
| 264 } | 264 } |
| 265 return result; | 265 return result; |
| 266 } | 266 } |
| OLD | NEW |