Chromium Code Reviews| Index: runtime/bin/path.dart |
| diff --git a/runtime/bin/path.dart b/runtime/bin/path.dart |
| index eea91c49cfb73c60c082b09d331fdbdd5ed5b75e..7984ab2653c18e506e619dc08c574038ea1f2ae5 100644 |
| --- a/runtime/bin/path.dart |
| +++ b/runtime/bin/path.dart |
| @@ -123,6 +123,14 @@ interface Path default _Path { |
| List<String> segments(); |
| /** |
| + * Appends [finalSegment] to a path as a new segment. Adds a path separator |
| + * between the path and [finalSegment] if the path does not already end in |
| + * a path separator. The path is not canonicalized, and [finalSegment] may |
| + * contain path separators. |
| + */ |
| + Path append(String finalSegment); |
| + |
| + /** |
| * Drops the final path separator and whatever follows it from this Path, |
| * and returns the resulting Path object. If the only path separator in |
| * this Path is the first character, returns '/' instead of the empty string. |
| @@ -147,7 +155,7 @@ interface Path default _Path { |
| /** |
| * The part of [filename] before the last '.', or the entire filename if it |
| - * contains no '.'. |
| + * contains no '.'. If [filename] is '.' or '..' it is unchanged. |
| * |
| * new Path('/c:/My Documents/Heidi.txt').filenameWithoutExtension |
| * would return 'Heidi'. |
| @@ -157,8 +165,16 @@ interface Path default _Path { |
| String get filenameWithoutExtension(); |
| /** |
| + * The new Path formed by removing the last '.', and everything following |
| + * it, from the filename part of this Path. Returns the path unchanged if |
| + * the path ends in a path separator, or if there is no '.' in the filename. |
| + * Returns the path unchanged if the filename is '.' or '..'. |
| + */ |
| + String get pathWithoutExtension(); |
|
Anders Johnsen
2012/06/22 07:33:45
Return type not consistent with comment. Should be
Mads Ager (google)
2012/06/22 07:41:41
I would remove this one. That does not seem like a
Bill Hesse
2012/06/22 11:01:55
Agreed - append makes it easier to write this.
On
|
| + |
| + /** |
| * The part of [filename] after the last '.', or '' if [filename] |
| - * contains no '.'. |
| + * contains no '.'. If [filename] is '.' or '..', returns ''. |
| * |
| * new Path('tiger.svg').extension == 'svg' |
| * new Path('/src/dart/dart_secrets').extension == '' |