| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library path.parsed_path; | 5 library path.parsed_path; |
| 6 | 6 |
| 7 import 'internal_style.dart'; | 7 import 'internal_style.dart'; |
| 8 import 'style.dart'; | 8 import 'style.dart'; |
| 9 | 9 |
| 10 class ParsedPath { | 10 class ParsedPath { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 List<String> separators; | 34 List<String> separators; |
| 35 | 35 |
| 36 /// The file extension of the last non-empty part, or "" if it doesn't have | 36 /// The file extension of the last non-empty part, or "" if it doesn't have |
| 37 /// one. | 37 /// one. |
| 38 String get extension => _splitExtension()[1]; | 38 String get extension => _splitExtension()[1]; |
| 39 | 39 |
| 40 /// `true` if this is an absolute path. | 40 /// `true` if this is an absolute path. |
| 41 bool get isAbsolute => root != null; | 41 bool get isAbsolute => root != null; |
| 42 | 42 |
| 43 factory ParsedPath.parse(String path, InternalStyle style) { | 43 factory ParsedPath.parse(String path, InternalStyle style) { |
| 44 var before = path; | |
| 45 | |
| 46 // Remove the root prefix, if any. | 44 // Remove the root prefix, if any. |
| 47 var root = style.getRoot(path); | 45 var root = style.getRoot(path); |
| 48 var isRootRelative = style.isRootRelative(path); | 46 var isRootRelative = style.isRootRelative(path); |
| 49 if (root != null) path = path.substring(root.length); | 47 if (root != null) path = path.substring(root.length); |
| 50 | 48 |
| 51 // Split the parts on path separators. | 49 // Split the parts on path separators. |
| 52 var parts = []; | 50 var parts = []; |
| 53 var separators = []; | 51 var separators = []; |
| 54 | 52 |
| 55 var start = 0; | 53 var start = 0; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (lastDot <= 0) return [file, '']; | 176 if (lastDot <= 0) return [file, '']; |
| 179 | 177 |
| 180 return [file.substring(0, lastDot), file.substring(lastDot)]; | 178 return [file.substring(0, lastDot), file.substring(lastDot)]; |
| 181 } | 179 } |
| 182 | 180 |
| 183 ParsedPath clone() => new ParsedPath._( | 181 ParsedPath clone() => new ParsedPath._( |
| 184 style, root, isRootRelative, | 182 style, root, isRootRelative, |
| 185 new List.from(parts), new List.from(separators)); | 183 new List.from(parts), new List.from(separators)); |
| 186 } | 184 } |
| 187 | 185 |
| OLD | NEW |