OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /// A comprehensive, cross-platform path manipulation library. | 5 /// A comprehensive, cross-platform path manipulation library. |
6 /// | 6 /// |
7 /// ## Installing ## | 7 /// ## Installing ## |
8 /// | 8 /// |
9 /// Use [pub][] to install this package. Add the following to your | 9 /// Use [pub][] to install this package. Add the following to your |
10 /// `pubspec.yaml` file. | 10 /// `pubspec.yaml` file. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 /// | 102 /// |
103 /// Trailing separators are ignored. | 103 /// Trailing separators are ignored. |
104 /// | 104 /// |
105 /// builder.basenameWithoutExtension('path/to/foo.dart/'); // -> 'foo' | 105 /// builder.basenameWithoutExtension('path/to/foo.dart/'); // -> 'foo' |
106 String basenameWithoutExtension(String path) => | 106 String basenameWithoutExtension(String path) => |
107 _builder.basenameWithoutExtension(path); | 107 _builder.basenameWithoutExtension(path); |
108 | 108 |
109 /// Gets the part of [path] before the last separator. | 109 /// Gets the part of [path] before the last separator. |
110 /// | 110 /// |
111 /// path.dirname('path/to/foo.dart'); // -> 'path/to' | 111 /// path.dirname('path/to/foo.dart'); // -> 'path/to' |
112 /// path.dirname('path/to'); // -> 'to' | 112 /// path.dirname('path/to'); // -> 'path' |
113 /// | 113 /// |
114 /// Trailing separators are ignored. | 114 /// Trailing separators are ignored. |
115 /// | 115 /// |
116 /// builder.dirname('path/to/'); // -> 'path' | 116 /// builder.dirname('path/to/'); // -> 'path' |
117 String dirname(String path) => _builder.dirname(path); | 117 String dirname(String path) => _builder.dirname(path); |
118 | 118 |
119 /// Gets the file extension of [path]: the portion of [basename] from the last | 119 /// Gets the file extension of [path]: the portion of [basename] from the last |
120 /// `.` to the end (including the `.` itself). | 120 /// `.` to the end (including the `.` itself). |
121 /// | 121 /// |
122 /// path.extension('path/to/foo.dart'); // -> '.dart' | 122 /// path.extension('path/to/foo.dart'); // -> '.dart' |
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 // doesn't count. | 1131 // doesn't count. |
1132 if (lastDot <= 0) return [file, '']; | 1132 if (lastDot <= 0) return [file, '']; |
1133 | 1133 |
1134 return [file.substring(0, lastDot), file.substring(lastDot)]; | 1134 return [file.substring(0, lastDot), file.substring(lastDot)]; |
1135 } | 1135 } |
1136 | 1136 |
1137 _ParsedPath clone() => new _ParsedPath( | 1137 _ParsedPath clone() => new _ParsedPath( |
1138 style, root, isRootRelative, | 1138 style, root, isRootRelative, |
1139 new List.from(parts), new List.from(separators)); | 1139 new List.from(parts), new List.from(separators)); |
1140 } | 1140 } |
OLD | NEW |