| 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 /** | 5 /** |
| 6 * A Path, which is a String interpreted as a sequence of path segments, | 6 * A Path, which is a String interpreted as a sequence of path segments, |
| 7 * which are strings, separated by forward slashes. | 7 * which are strings, separated by forward slashes. |
| 8 * Paths are immutable wrappers of a String, that offer member functions for | 8 * Paths are immutable wrappers of a String, that offer member functions for |
| 9 * useful path manipulations and queries. Joining of paths and normalization | 9 * useful path manipulations and queries. Joining of paths and normalization |
| 10 * interpret '.' and '..' in the usual way. | 10 * interpret '.' and '..' in the usual way. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * Creates a Path from a String that uses the native filesystem's conventions. | 22 * Creates a Path from a String that uses the native filesystem's conventions. |
| 23 * On Windows, this converts '\' to '/', and adds a '/' before a drive letter. | 23 * On Windows, this converts '\' to '/', and adds a '/' before a drive letter. |
| 24 * A path starting with '/c:/' (or any other character instead of 'c') is | 24 * A path starting with '/c:/' (or any other character instead of 'c') is |
| 25 * treated specially. Backwards links ('..') cannot cancel the drive letter. | 25 * treated specially. Backwards links ('..') cannot cancel the drive letter. |
| 26 */ | 26 */ |
| 27 Path.fromNative(String source); | 27 Path.fromNative(String source); |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * Is this path the empty string? | 30 * Is this path the empty string? |
| 31 */ | 31 */ |
| 32 bool get isEmpty(); | 32 bool get isEmpty; |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Is this path an absolute path, beginning with a path separator? | 35 * Is this path an absolute path, beginning with a path separator? |
| 36 */ | 36 */ |
| 37 bool get isAbsolute(); | 37 bool get isAbsolute; |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Does this path end with a path separator? | 40 * Does this path end with a path separator? |
| 41 */ | 41 */ |
| 42 bool get hasTrailingSeparator(); | 42 bool get hasTrailingSeparator; |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Does this path contain no consecutive path separators, no segments that | 45 * Does this path contain no consecutive path separators, no segments that |
| 46 * are '.' unless the path is exactly '.', and segments that are '..' only | 46 * are '.' unless the path is exactly '.', and segments that are '..' only |
| 47 * as the leading segments on a relative path? | 47 * as the leading segments on a relative path? |
| 48 */ | 48 */ |
| 49 bool get isCanonical(); | 49 bool get isCanonical; |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * Make a path canonical by dropping segments that are '.', cancelling | 52 * Make a path canonical by dropping segments that are '.', cancelling |
| 53 * segments that are '..' with preceding segments, if possible, | 53 * segments that are '..' with preceding segments, if possible, |
| 54 * and combining consecutive path separators. Leading '..' segments | 54 * and combining consecutive path separators. Leading '..' segments |
| 55 * are kept on relative paths, and dropped from absolute paths. | 55 * are kept on relative paths, and dropped from absolute paths. |
| 56 */ | 56 */ |
| 57 Path canonicalize(); | 57 Path canonicalize(); |
| 58 | 58 |
| 59 /** | 59 /** |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 * and returns the resulting Path object. If the only path separator in | 135 * and returns the resulting Path object. If the only path separator in |
| 136 * this Path is the first character, returns '/' instead of the empty string. | 136 * this Path is the first character, returns '/' instead of the empty string. |
| 137 * If there is no path separator in the Path, returns the empty string. | 137 * If there is no path separator in the Path, returns the empty string. |
| 138 * | 138 * |
| 139 * new Path('../images/dot.gif').directoryPath == '../images' | 139 * new Path('../images/dot.gif').directoryPath == '../images' |
| 140 * new Path('/usr/geoffrey/www/').directoryPath == '/usr/geoffrey/www' | 140 * new Path('/usr/geoffrey/www/').directoryPath == '/usr/geoffrey/www' |
| 141 * new Path('lost_file_old').directoryPath == '' | 141 * new Path('lost_file_old').directoryPath == '' |
| 142 * new Path('/src').directoryPath == '/' | 142 * new Path('/src').directoryPath == '/' |
| 143 * Note: new Path('/D:/src').directoryPath == '/D:' | 143 * Note: new Path('/D:/src').directoryPath == '/D:' |
| 144 */ | 144 */ |
| 145 Path get directoryPath(); | 145 Path get directoryPath; |
| 146 | 146 |
| 147 /** | 147 /** |
| 148 * The part of the path after the last path separator, or the entire path if | 148 * The part of the path after the last path separator, or the entire path if |
| 149 * it contains no path separator. | 149 * it contains no path separator. |
| 150 * | 150 * |
| 151 * new Path('images/DSC_0027.jpg).filename == 'DSC_0027.jpg' | 151 * new Path('images/DSC_0027.jpg).filename == 'DSC_0027.jpg' |
| 152 * new Path('users/fred/').filename == '' | 152 * new Path('users/fred/').filename == '' |
| 153 */ | 153 */ |
| 154 String get filename(); | 154 String get filename; |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * The part of [filename] before the last '.', or the entire filename if it | 157 * The part of [filename] before the last '.', or the entire filename if it |
| 158 * contains no '.'. If [filename] is '.' or '..' it is unchanged. | 158 * contains no '.'. If [filename] is '.' or '..' it is unchanged. |
| 159 * | 159 * |
| 160 * new Path('/c:/My Documents/Heidi.txt').filenameWithoutExtension | 160 * new Path('/c:/My Documents/Heidi.txt').filenameWithoutExtension |
| 161 * would return 'Heidi'. | 161 * would return 'Heidi'. |
| 162 * new Path('not what I would call a path').filenameWithoutExtension | 162 * new Path('not what I would call a path').filenameWithoutExtension |
| 163 * would return 'not what I would call a path'. | 163 * would return 'not what I would call a path'. |
| 164 */ | 164 */ |
| 165 String get filenameWithoutExtension(); | 165 String get filenameWithoutExtension; |
| 166 | 166 |
| 167 /** | 167 /** |
| 168 * The part of [filename] after the last '.', or '' if [filename] | 168 * The part of [filename] after the last '.', or '' if [filename] |
| 169 * contains no '.'. If [filename] is '.' or '..', returns ''. | 169 * contains no '.'. If [filename] is '.' or '..', returns ''. |
| 170 * | 170 * |
| 171 * new Path('tiger.svg').extension == 'svg' | 171 * new Path('tiger.svg').extension == 'svg' |
| 172 * new Path('/src/dart/dart_secrets').extension == '' | 172 * new Path('/src/dart/dart_secrets').extension == '' |
| 173 */ | 173 */ |
| 174 String get extension(); | 174 String get extension; |
| 175 } | 175 } |
| OLD | NEW |