| 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 library path; | 6 library path; |
| 7 | 7 |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 /// An internal builder for the current OS so we can provide a straight | 10 /// An internal builder for the current OS so we can provide a straight |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 String get separator => style.separator; | 238 String get separator => style.separator; |
| 239 | 239 |
| 240 /// Gets the part of [path] after the last separator on the builder's | 240 /// Gets the part of [path] after the last separator on the builder's |
| 241 /// platform. | 241 /// platform. |
| 242 /// | 242 /// |
| 243 /// builder.basename('path/to/foo.dart'); // -> 'foo.dart' | 243 /// builder.basename('path/to/foo.dart'); // -> 'foo.dart' |
| 244 /// builder.basename('path/to'); // -> 'to' | 244 /// builder.basename('path/to'); // -> 'to' |
| 245 /// | 245 /// |
| 246 /// Trailing separators are ignored. | 246 /// Trailing separators are ignored. |
| 247 /// | 247 /// |
| 248 /// builder.dirname('path/to/'); // -> 'to' | 248 /// builder.basename('path/to/'); // -> 'to' |
| 249 String basename(String path) => _parse(path).basename; | 249 String basename(String path) => _parse(path).basename; |
| 250 | 250 |
| 251 /// Gets the part of [path] after the last separator on the builder's | 251 /// Gets the part of [path] after the last separator on the builder's |
| 252 /// platform, and without any trailing file extension. | 252 /// platform, and without any trailing file extension. |
| 253 /// | 253 /// |
| 254 /// builder.basenameWithoutExtension('path/to/foo.dart'); // -> 'foo' | 254 /// builder.basenameWithoutExtension('path/to/foo.dart'); // -> 'foo' |
| 255 /// | 255 /// |
| 256 /// Trailing separators are ignored. | 256 /// Trailing separators are ignored. |
| 257 /// | 257 /// |
| 258 /// builder.dirname('path/to/foo.dart/'); // -> 'foo' | 258 /// builder.basenameWithoutExtension('path/to/foo.dart/'); // -> 'foo' |
| 259 String basenameWithoutExtension(String path) => | 259 String basenameWithoutExtension(String path) => |
| 260 _parse(path).basenameWithoutExtension; | 260 _parse(path).basenameWithoutExtension; |
| 261 | 261 |
| 262 /// Gets the part of [path] before the last separator. | 262 /// Gets the part of [path] before the last separator. |
| 263 /// | 263 /// |
| 264 /// builder.dirname('path/to/foo.dart'); // -> 'path/to' | 264 /// builder.dirname('path/to/foo.dart'); // -> 'path/to' |
| 265 /// builder.dirname('path/to'); // -> 'path' | 265 /// builder.dirname('path/to'); // -> 'path' |
| 266 /// | 266 /// |
| 267 /// Trailing separators are ignored. | 267 /// Trailing separators are ignored. |
| 268 /// | 268 /// |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 // doesn't count. | 726 // doesn't count. |
| 727 if (lastDot <= 0) return [file, '']; | 727 if (lastDot <= 0) return [file, '']; |
| 728 | 728 |
| 729 return [file.substring(0, lastDot), file.substring(lastDot)]; | 729 return [file.substring(0, lastDot), file.substring(lastDot)]; |
| 730 } | 730 } |
| 731 | 731 |
| 732 _ParsedPath clone() => new _ParsedPath( | 732 _ParsedPath clone() => new _ParsedPath( |
| 733 style, root, new List.from(parts, growable: true), | 733 style, root, new List.from(parts, growable: true), |
| 734 new List.from(separators, growable: true)); | 734 new List.from(separators, growable: true)); |
| 735 } | 735 } |
| OLD | NEW |