| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 /// // URL | 282 /// // URL |
| 283 /// path.fromUri(Uri.parse('http://dartlang.org/path/to/foo')) | 283 /// path.fromUri(Uri.parse('http://dartlang.org/path/to/foo')) |
| 284 /// // -> 'http://dartlang.org/path/to/foo' | 284 /// // -> 'http://dartlang.org/path/to/foo' |
| 285 String fromUri(Uri uri) => _builder.fromUri(uri); | 285 String fromUri(Uri uri) => _builder.fromUri(uri); |
| 286 | 286 |
| 287 /// Returns the URI that represents [path]. | 287 /// Returns the URI that represents [path]. |
| 288 /// | 288 /// |
| 289 /// For POSIX and Windows styles, this will return a `file:` URI. For the URL | 289 /// For POSIX and Windows styles, this will return a `file:` URI. For the URL |
| 290 /// style, this will just convert [path] to a [Uri]. | 290 /// style, this will just convert [path] to a [Uri]. |
| 291 /// | 291 /// |
| 292 /// This will always convert relative paths to absolute ones before converting | |
| 293 /// to a URI. | |
| 294 /// | |
| 295 /// // POSIX | 292 /// // POSIX |
| 296 /// path.toUri('/path/to/foo') | 293 /// path.toUri('/path/to/foo') |
| 297 /// // -> Uri.parse('file:///path/to/foo') | 294 /// // -> Uri.parse('file:///path/to/foo') |
| 298 /// | 295 /// |
| 299 /// // Windows | 296 /// // Windows |
| 300 /// path.toUri(r'C:\path\to\foo') | 297 /// path.toUri(r'C:\path\to\foo') |
| 301 /// // -> Uri.parse('file:///C:/path/to/foo') | 298 /// // -> Uri.parse('file:///C:/path/to/foo') |
| 302 /// | 299 /// |
| 303 /// // URL | 300 /// // URL |
| 304 /// path.toUri('http://dartlang.org/path/to/foo') | 301 /// path.toUri('http://dartlang.org/path/to/foo') |
| 305 /// // -> Uri.parse('http://dartlang.org/path/to/foo') | 302 /// // -> Uri.parse('http://dartlang.org/path/to/foo') |
| 303 /// |
| 304 /// If [path] is relative, a relative URI will be returned. |
| 305 /// |
| 306 /// path.toUri('path/to/foo') |
| 307 /// // -> Uri.parse('path/to/foo') |
| 306 Uri toUri(String path) => _builder.toUri(path); | 308 Uri toUri(String path) => _builder.toUri(path); |
| 307 | 309 |
| 308 /// Validates that there are no non-null arguments following a null one and | 310 /// Validates that there are no non-null arguments following a null one and |
| 309 /// throws an appropriate [ArgumentError] on failure. | 311 /// throws an appropriate [ArgumentError] on failure. |
| 310 _validateArgList(String method, List<String> args) { | 312 _validateArgList(String method, List<String> args) { |
| 311 for (var i = 1; i < args.length; i++) { | 313 for (var i = 1; i < args.length; i++) { |
| 312 // Ignore nulls hanging off the end. | 314 // Ignore nulls hanging off the end. |
| 313 if (args[i] == null || args[i - 1] != null) continue; | 315 if (args[i] == null || args[i - 1] != null) continue; |
| 314 | 316 |
| 315 var numArgs; | 317 var numArgs; |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 // doesn't count. | 1127 // doesn't count. |
| 1126 if (lastDot <= 0) return [file, '']; | 1128 if (lastDot <= 0) return [file, '']; |
| 1127 | 1129 |
| 1128 return [file.substring(0, lastDot), file.substring(lastDot)]; | 1130 return [file.substring(0, lastDot), file.substring(lastDot)]; |
| 1129 } | 1131 } |
| 1130 | 1132 |
| 1131 _ParsedPath clone() => new _ParsedPath( | 1133 _ParsedPath clone() => new _ParsedPath( |
| 1132 style, root, isRootRelative, | 1134 style, root, isRootRelative, |
| 1133 new List.from(parts), new List.from(separators)); | 1135 new List.from(parts), new List.from(separators)); |
| 1134 } | 1136 } |
| OLD | NEW |