Chromium Code Reviews| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |