| 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 22 matching lines...) Expand all Loading... |
| 33 */ | 33 */ |
| 34 void _growListFront(List list, int length, fillValue) { | 34 void _growListFront(List list, int length, fillValue) { |
| 35 list.length += length; | 35 list.length += length; |
| 36 list.setRange(length, list.length, list); | 36 list.setRange(length, list.length, list); |
| 37 for (var i = 0; i < length; i++) { | 37 for (var i = 0; i < length; i++) { |
| 38 list[i] = fillValue; | 38 list[i] = fillValue; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 /// Gets the path to the current working directory. | 42 /// Gets the path to the current working directory. |
| 43 String get current => new io.Directory.current().path; | 43 String get current => io.Directory.current.path; |
| 44 | 44 |
| 45 /// Gets the path separator for the current platform. On Mac and Linux, this | 45 /// Gets the path separator for the current platform. On Mac and Linux, this |
| 46 /// is `/`. On Windows, it's `\`. | 46 /// is `/`. On Windows, it's `\`. |
| 47 String get separator => _builder.separator; | 47 String get separator => _builder.separator; |
| 48 | 48 |
| 49 /// Converts [path] to an absolute path by resolving it relative to the current | 49 /// Converts [path] to an absolute path by resolving it relative to the current |
| 50 /// working directory. If [path] is already an absolute path, just returns it. | 50 /// working directory. If [path] is already an absolute path, just returns it. |
| 51 /// | 51 /// |
| 52 /// path.absolute('foo/bar.txt'); // -> /your/current/dir/foo/bar.txt | 52 /// path.absolute('foo/bar.txt'); // -> /your/current/dir/foo/bar.txt |
| 53 String absolute(String path) => join(current, path); | 53 String absolute(String path) => join(current, path); |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 // If there is no dot, or it's the first character, like '.bashrc', it | 753 // If there is no dot, or it's the first character, like '.bashrc', it |
| 754 // doesn't count. | 754 // doesn't count. |
| 755 if (lastDot <= 0) return [file, '']; | 755 if (lastDot <= 0) return [file, '']; |
| 756 | 756 |
| 757 return [file.substring(0, lastDot), file.substring(lastDot)]; | 757 return [file.substring(0, lastDot), file.substring(lastDot)]; |
| 758 } | 758 } |
| 759 | 759 |
| 760 _ParsedPath clone() => new _ParsedPath( | 760 _ParsedPath clone() => new _ParsedPath( |
| 761 style, root, new List.from(parts), new List.from(separators)); | 761 style, root, new List.from(parts), new List.from(separators)); |
| 762 } | 762 } |
| OLD | NEW |