Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: pkg/path/lib/path.dart

Issue 12047035: Add a README for path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revised. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/path/README.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library path; 6 library path;
7 7
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 /// An internal builder for the current OS so we can provide a straight 10 /// An internal builder for the current OS so we can provide a straight
(...skipping 13 matching lines...) Expand all
24 /// path.absolute('foo/bar.txt'); // -> /your/current/dir/foo/bar.txt 24 /// path.absolute('foo/bar.txt'); // -> /your/current/dir/foo/bar.txt
25 String absolute(String path) => join(current, path); 25 String absolute(String path) => join(current, path);
26 26
27 /// Gets the part of [path] after the last separator. 27 /// Gets the part of [path] after the last separator.
28 /// 28 ///
29 /// path.basename('path/to/foo.dart'); // -> 'foo.dart' 29 /// path.basename('path/to/foo.dart'); // -> 'foo.dart'
30 /// path.basename('path/to'); // -> 'to' 30 /// path.basename('path/to'); // -> 'to'
31 /// 31 ///
32 /// Trailing separators are ignored. 32 /// Trailing separators are ignored.
33 /// 33 ///
34 /// builder.dirname('path/to/'); // -> 'to' 34 /// builder.basename('path/to/'); // -> 'to'
35 String basename(String path) => _builder.basename(path); 35 String basename(String path) => _builder.basename(path);
36 36
37 /// Gets the part of [path] after the last separator, and without any trailing 37 /// Gets the part of [path] after the last separator, and without any trailing
38 /// file extension. 38 /// file extension.
39 /// 39 ///
40 /// path.basenameWithoutExtension('path/to/foo.dart'); // -> 'foo' 40 /// path.basenameWithoutExtension('path/to/foo.dart'); // -> 'foo'
41 /// 41 ///
42 /// Trailing separators are ignored. 42 /// Trailing separators are ignored.
43 /// 43 ///
44 /// builder.dirname('path/to/foo.dart/'); // -> 'foo' 44 /// builder.basenameWithoutExtension('path/to/foo.dart/'); // -> 'foo'
45 String basenameWithoutExtension(String path) => 45 String basenameWithoutExtension(String path) =>
46 _builder.basenameWithoutExtension(path); 46 _builder.basenameWithoutExtension(path);
47 47
48 /// Gets the part of [path] before the last separator. 48 /// Gets the part of [path] before the last separator.
49 /// 49 ///
50 /// path.dirname('path/to/foo.dart'); // -> 'path/to' 50 /// path.dirname('path/to/foo.dart'); // -> 'path/to'
51 /// path.dirname('path/to'); // -> 'to' 51 /// path.dirname('path/to'); // -> 'to'
52 /// 52 ///
53 /// Trailing separators are ignored. 53 /// Trailing separators are ignored.
54 /// 54 ///
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 // If there is no dot, or it's the first character, like '.bashrc', it 692 // If there is no dot, or it's the first character, like '.bashrc', it
693 // doesn't count. 693 // doesn't count.
694 if (lastDot <= 0) return [file, '']; 694 if (lastDot <= 0) return [file, ''];
695 695
696 return [file.substring(0, lastDot), file.substring(lastDot)]; 696 return [file.substring(0, lastDot), file.substring(lastDot)];
697 } 697 }
698 698
699 _ParsedPath clone() => new _ParsedPath( 699 _ParsedPath clone() => new _ParsedPath(
700 style, root, new List.from(parts), new List.from(separators)); 700 style, root, new List.from(parts), new List.from(separators));
701 } 701 }
OLDNEW
« no previous file with comments | « pkg/path/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698