4
4
5
5
/// A comprehensive, cross-platform path manipulation library.
6
6
///
7
- /// ## Installing ##
8
- ///
9
- /// Use [pub][] to install this package. Add the following to your
10
- /// `pubspec.yaml` file.
11
- ///
12
- /// dependencies:
13
- /// path: any
14
- ///
15
- /// Then run `pub install` .
16
- ///
17
- /// For more information, see the [path package on pub.dartlang.org][pkg] .
18
- ///
19
- /// [pub] : http://pub.dartlang.org
20
- /// [pkg] : http://pub.dartlang.org/packages/path
21
- ///
22
- /// ## Usage ##
23
- ///
24
7
/// The path library was designed to be imported with a prefix, though you don't
25
8
/// have to if you don't want to:
26
9
///
30
13
/// These manipulate path strings based on your current working directory and
31
14
/// the path style (POSIX, Windows, or URLs) of the host platform. For example:
32
15
///
33
- /// p.join(" directory", " file.txt" );
16
+ /// p.join(' directory', ' file.txt' );
34
17
///
35
18
/// This calls the top-level [join] function to join "directory" and "file.txt"
36
19
/// using the current platform's directory separator.
39
22
/// underlying platform that the program is running on, you can create a
40
23
/// [Context] and give it an explicit [Style] :
41
24
///
42
- /// var context = new p.Context(style: Style.windows);
43
- /// context.join(" directory", " file.txt" );
25
+ /// var context = p.Context(style: Style.windows);
26
+ /// context.join(' directory', ' file.txt' );
44
27
///
45
28
/// This will join "directory" and "file.txt" using the Windows path separator,
46
29
/// even when the program is run on a POSIX machine.
@@ -221,8 +204,8 @@ String extension(String path, [int level = 1]) =>
221
204
///
222
205
/// // URL
223
206
/// p.rootPrefix('path/to/foo'); // -> ''
224
- /// p.rootPrefix('http ://dartlang.org /path/to/foo');
225
- /// // -> 'http ://dartlang.org '
207
+ /// p.rootPrefix('https ://dart.dev /path/to/foo');
208
+ /// // -> 'https ://dart.dev '
226
209
String rootPrefix (String path) => context.rootPrefix (path);
227
210
228
211
/// Returns `true` if [path] is an absolute path and `false` if it is a
@@ -231,7 +214,7 @@ String rootPrefix(String path) => context.rootPrefix(path);
231
214
/// On POSIX systems, absolute paths start with a `/` (forward slash). On
232
215
/// Windows, an absolute path starts with `\\` , or a drive letter followed by
233
216
/// `:/` or `:\` . For URLs, absolute paths either start with a protocol and
234
- /// optional hostname (e.g. `http ://dartlang.org ` , `file://` ) or with a `/` .
217
+ /// optional hostname (e.g. `https ://dart.dev ` , `file://` ) or with a `/` .
235
218
///
236
219
/// URLs that start with `/` are known as "root-relative", since they're
237
220
/// relative to the root of the current URL. Since root-relative paths are still
@@ -315,8 +298,8 @@ String joinAll(Iterable<String> parts) => context.joinAll(parts);
315
298
/// // -> [r'\\server\share', 'foo', 'bar', 'baz']
316
299
///
317
300
/// // Browser
318
- /// p.split('http ://dartlang.org /path/to/foo');
319
- /// // -> ['http ://dartlang.org ', 'path', 'to', 'foo']
301
+ /// p.split('https ://dart.dev /path/to/foo');
302
+ /// // -> ['https ://dart.dev ', 'path', 'to', 'foo']
320
303
List <String > split (String path) => context.split (path);
321
304
322
305
/// Canonicalizes [path] .
@@ -367,8 +350,8 @@ String normalize(String path) => context.normalize(path);
367
350
/// p.relative(r'D:\other', from: r'C:\home'); // -> 'D:\other'
368
351
///
369
352
/// // URL
370
- /// p.relative('http ://dartlang.org ', from: 'http ://pub.dartlang.org ');
371
- /// // -> 'http ://dartlang.org '
353
+ /// p.relative('https ://dart.dev ', from: 'https ://pub.dev ');
354
+ /// // -> 'https ://dart.dev '
372
355
String relative (String path, {String from}) =>
373
356
context.relative (path, from: from);
374
357
@@ -422,8 +405,8 @@ String setExtension(String path, String extension) =>
422
405
/// p.fromUri('file:///C:/path/to/foo') // -> r'C:\path\to\foo'
423
406
///
424
407
/// // URL
425
- /// p.fromUri('http ://dartlang.org /path/to/foo')
426
- /// // -> 'http ://dartlang.org /path/to/foo'
408
+ /// p.fromUri('https ://dart.dev /path/to/foo')
409
+ /// // -> 'https ://dart.dev /path/to/foo'
427
410
///
428
411
/// If [uri] is relative, a relative path will be returned.
429
412
///
@@ -444,8 +427,8 @@ String fromUri(uri) => context.fromUri(uri);
444
427
/// // -> Uri.parse('file:///C:/path/to/foo')
445
428
///
446
429
/// // URL
447
- /// p.toUri('http ://dartlang.org /path/to/foo')
448
- /// // -> Uri.parse('http ://dartlang.org /path/to/foo')
430
+ /// p.toUri('https ://dart.dev /path/to/foo')
431
+ /// // -> Uri.parse('https ://dart.dev /path/to/foo')
449
432
///
450
433
/// If [path] is relative, a relative URI will be returned.
451
434
///
@@ -463,13 +446,13 @@ Uri toUri(String path) => context.toUri(path);
463
446
///
464
447
/// // POSIX at "/root/path"
465
448
/// p.prettyUri('file:///root/path/a/b.dart'); // -> 'a/b.dart'
466
- /// p.prettyUri('http ://dartlang.org /'); // -> 'http ://dartlang.org '
449
+ /// p.prettyUri('https ://dart.dev /'); // -> 'https ://dart.dev '
467
450
///
468
451
/// // Windows at "C:\root\path"
469
452
/// p.prettyUri('file:///C:/root/path/a/b.dart'); // -> r'a\b.dart'
470
- /// p.prettyUri('http ://dartlang.org /'); // -> 'http ://dartlang.org '
453
+ /// p.prettyUri('https ://dart.dev /'); // -> 'https ://dart.dev '
471
454
///
472
- /// // URL at "http ://dartlang.org /root/path"
473
- /// p.prettyUri('http ://dartlang.org /root/path/a/b.dart'); // -> r'a/b.dart'
455
+ /// // URL at "https ://dart.dev /root/path"
456
+ /// p.prettyUri('https ://dart.dev /root/path/a/b.dart'); // -> r'a/b.dart'
474
457
/// p.prettyUri('file:///root/path'); // -> 'file:///root/path'
475
458
String prettyUri (uri) => context.prettyUri (uri);
0 commit comments