Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 A comprehensive, cross-platform path manipulation library for Dart. | 1 A comprehensive, cross-platform path manipulation library for Dart. |
| 2 | 2 |
| 3 The path package provides common operations for manipulating file paths: | 3 The path package provides common operations for manipulating file paths: |
| 4 joining, splitting, normalizing, etc. | 4 joining, splitting, normalizing, etc. |
| 5 | 5 |
| 6 We've tried very hard to make this library do the "right" thing on whatever | 6 We've tried very hard to make this library do the "right" thing on whatever |
| 7 platform you run it on. When you use the top-level functions, it will assume the | 7 platform you run it on. When you use the top-level functions, it will assume the |
| 8 current platform's path style and work with that. If you want to specifically | 8 current platform's path style and work with that. If you want to specifically |
| 9 work with paths of a specific style, you can construct a `path.Builder` for that | 9 work with paths of a specific style, you can construct a `path.Builder` for that |
| 10 style. | 10 style. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 | 66 |
| 67 Gets the part of [path] before the last separator. | 67 Gets the part of [path] before the last separator. |
| 68 | 68 |
| 69 path.dirname('path/to/foo.dart'); // -> 'path/to' | 69 path.dirname('path/to/foo.dart'); // -> 'path/to' |
| 70 path.dirname('path/to'); // -> 'to' | 70 path.dirname('path/to'); // -> 'to' |
| 71 | 71 |
| 72 Trailing separators are ignored. | 72 Trailing separators are ignored. |
| 73 | 73 |
| 74 builder.dirname('path/to/'); // -> 'path' | 74 builder.dirname('path/to/'); // -> 'path' |
| 75 | 75 |
| 76 If an absolute path contains no directories, only a root, then the root | |
| 77 is returned. | |
| 78 | |
| 79 path.dirname('/'); // -> '/' (posix) | |
| 80 path.dirname('c:\'); // -> 'c:\' (windows) | |
| 81 | |
| 82 If a relative path has no directories, then '.' is returned. | |
|
Bob Nystrom
2013/07/15 17:49:29
You'll want a blank line after this. Markdown need
Bill Hesse
2013/07/16 12:42:26
Done.
| |
| 83 path.dirname('foo'); // -> '.' | |
| 84 path.dirname(''); // -> '.' | |
| 85 | |
|
Bob Nystrom
2013/07/15 17:49:29
I like this.
| |
| 76 ### String extension(String path) | 86 ### String extension(String path) |
| 77 | 87 |
| 78 Gets the file extension of [path]: the portion of [basename] from the last | 88 Gets the file extension of [path]: the portion of [basename] from the last |
| 79 `.` to the end (including the `.` itself). | 89 `.` to the end (including the `.` itself). |
| 80 | 90 |
| 81 path.extension('path/to/foo.dart'); // -> '.dart' | 91 path.extension('path/to/foo.dart'); // -> '.dart' |
| 82 path.extension('path/to/foo'); // -> '' | 92 path.extension('path/to/foo'); // -> '' |
| 83 path.extension('path.to/foo'); // -> '' | 93 path.extension('path.to/foo'); // -> '' |
| 84 path.extension('path/to/foo.dart.js'); // -> '.js' | 94 path.extension('path/to/foo.dart.js'); // -> '.js' |
| 85 | 95 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 * It can accurately tell if a path is absolute based on drive-letters or UNC | 394 * It can accurately tell if a path is absolute based on drive-letters or UNC |
| 385 prefix. | 395 prefix. |
| 386 | 396 |
| 387 * It understands that "/foo" is not an absolute path on Windows. | 397 * It understands that "/foo" is not an absolute path on Windows. |
| 388 | 398 |
| 389 * It knows that "C:\foo\one.txt" and "c:/foo\two.txt" are two files in the | 399 * It knows that "C:\foo\one.txt" and "c:/foo\two.txt" are two files in the |
| 390 same directory. | 400 same directory. |
| 391 | 401 |
| 392 If you find a problem, surprise or something that's unclear, please don't | 402 If you find a problem, surprise or something that's unclear, please don't |
| 393 hesitate to [file a bug](http://dartbug.com/new) and let us know. | 403 hesitate to [file a bug](http://dartbug.com/new) and let us know. |
| OLD | NEW |