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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 /// path.isWithin('/root/path', '/root/path/a'); // -> true | 315 /// path.isWithin('/root/path', '/root/path/a'); // -> true |
316 /// path.isWithin('/root/path', '/root/other'); // -> false | 316 /// path.isWithin('/root/path', '/root/other'); // -> false |
317 /// path.isWithin('/root/path', '/root/path') // -> false | 317 /// path.isWithin('/root/path', '/root/path') // -> false |
318 bool isWithin(String parent, String child) => _context.isWithin(parent, child); | 318 bool isWithin(String parent, String child) => _context.isWithin(parent, child); |
319 | 319 |
320 /// Removes a trailing extension from the last part of [path]. | 320 /// Removes a trailing extension from the last part of [path]. |
321 /// | 321 /// |
322 /// withoutExtension('path/to/foo.dart'); // -> 'path/to/foo' | 322 /// withoutExtension('path/to/foo.dart'); // -> 'path/to/foo' |
323 String withoutExtension(String path) => _context.withoutExtension(path); | 323 String withoutExtension(String path) => _context.withoutExtension(path); |
324 | 324 |
325 /// Returns the path represented by [uri]. | 325 /// Returns the path represented by [uri], which may be a [String] or a [Uri]. |
326 /// | 326 /// |
327 /// For POSIX and Windows styles, [uri] must be a `file:` URI. For the URL | 327 /// For POSIX and Windows styles, [uri] must be a `file:` URI. For the URL |
328 /// style, this will just convert [uri] to a string. | 328 /// style, this will just convert [uri] to a string. |
329 /// | 329 /// |
330 /// // POSIX | 330 /// // POSIX |
331 /// path.fromUri(Uri.parse('file:///path/to/foo')) | 331 /// context.fromUri('file:///path/to/foo') |
332 /// // -> '/path/to/foo' | 332 /// // -> '/path/to/foo' |
333 /// | 333 /// |
334 /// // Windows | 334 /// // Windows |
335 /// path.fromUri(Uri.parse('file:///C:/path/to/foo')) | 335 /// context.fromUri('file:///C:/path/to/foo') |
336 /// // -> r'C:\path\to\foo' | 336 /// // -> r'C:\path\to\foo' |
337 /// | 337 /// |
338 /// // URL | 338 /// // URL |
339 /// path.fromUri(Uri.parse('http://dartlang.org/path/to/foo')) | 339 /// context.fromUri('http://dartlang.org/path/to/foo') |
340 /// // -> 'http://dartlang.org/path/to/foo' | 340 /// // -> 'http://dartlang.org/path/to/foo' |
341 String fromUri(Uri uri) => _context.fromUri(uri); | 341 /// |
| 342 /// If [uri] is relative, a relative path will be returned. |
| 343 /// |
| 344 /// path.fromUri('path/to/foo'); // -> 'path/to/foo' |
| 345 String fromUri(uri) => _context.fromUri(uri); |
342 | 346 |
343 /// Returns the URI that represents [path]. | 347 /// Returns the URI that represents [path]. |
344 /// | 348 /// |
345 /// For POSIX and Windows styles, this will return a `file:` URI. For the URL | 349 /// For POSIX and Windows styles, this will return a `file:` URI. For the URL |
346 /// style, this will just convert [path] to a [Uri]. | 350 /// style, this will just convert [path] to a [Uri]. |
347 /// | 351 /// |
348 /// // POSIX | 352 /// // POSIX |
349 /// path.toUri('/path/to/foo') | 353 /// path.toUri('/path/to/foo') |
350 /// // -> Uri.parse('file:///path/to/foo') | 354 /// // -> Uri.parse('file:///path/to/foo') |
351 /// | 355 /// |
352 /// // Windows | 356 /// // Windows |
353 /// path.toUri(r'C:\path\to\foo') | 357 /// path.toUri(r'C:\path\to\foo') |
354 /// // -> Uri.parse('file:///C:/path/to/foo') | 358 /// // -> Uri.parse('file:///C:/path/to/foo') |
355 /// | 359 /// |
356 /// // URL | 360 /// // URL |
357 /// path.toUri('http://dartlang.org/path/to/foo') | 361 /// path.toUri('http://dartlang.org/path/to/foo') |
358 /// // -> Uri.parse('http://dartlang.org/path/to/foo') | 362 /// // -> Uri.parse('http://dartlang.org/path/to/foo') |
359 /// | 363 /// |
360 /// If [path] is relative, a relative URI will be returned. | 364 /// If [path] is relative, a relative URI will be returned. |
361 /// | 365 /// |
362 /// path.toUri('path/to/foo') | 366 /// path.toUri('path/to/foo') |
363 /// // -> Uri.parse('path/to/foo') | 367 /// // -> Uri.parse('path/to/foo') |
364 Uri toUri(String path) => _context.toUri(path); | 368 Uri toUri(String path) => _context.toUri(path); |
OLD | NEW |