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

Side by Side Diff: utils/pub/io.dart

Issue 11471048: Revise path library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | « no previous file | utils/pub/path.dart » ('j') | 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 /** 5 /**
6 * Helper functionality to make working with IO easier. 6 * Helper functionality to make working with IO easier.
7 */ 7 */
8 library io; 8 library io;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return path.join(part1, part2, part3); 43 return path.join(part1, part2, part3);
44 } else if (part2 != null) { 44 } else if (part2 != null) {
45 return path.join(part1, part2); 45 return path.join(part1, part2);
46 } else { 46 } else {
47 return path.join(part1); 47 return path.join(part1);
48 } 48 }
49 } 49 }
50 50
51 /// Gets the basename, the file name without any leading directory path, for 51 /// Gets the basename, the file name without any leading directory path, for
52 /// [file], which can either be a [String], [File], or [Directory]. 52 /// [file], which can either be a [String], [File], or [Directory].
53 String basename(file) => path.filename(_getPath(file)); 53 String basename(file) => path.basename(_getPath(file));
54 54
55 // TODO(nweiz): move this into path.dart. 55 // TODO(nweiz): move this into path.dart.
56 /// Gets the the leading directory path for [file], which can either be a 56 /// Gets the the leading directory path for [file], which can either be a
57 /// [String], [File], or [Directory]. 57 /// [String], [File], or [Directory].
58 String dirname(file) { 58 String dirname(file) {
59 file = _sanitizePath(file); 59 file = _sanitizePath(file);
60 60
61 int lastSlash = file.lastIndexOf('/', file.length); 61 int lastSlash = file.lastIndexOf('/', file.length);
62 if (lastSlash == -1) { 62 if (lastSlash == -1) {
63 return '.'; 63 return '.';
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 return new Directory(entry); 1122 return new Directory(entry);
1123 } 1123 }
1124 1124
1125 /** 1125 /**
1126 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 1126 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
1127 */ 1127 */
1128 Uri _getUri(uri) { 1128 Uri _getUri(uri) {
1129 if (uri is Uri) return uri; 1129 if (uri is Uri) return uri;
1130 return new Uri.fromString(uri); 1130 return new Uri.fromString(uri);
1131 } 1131 }
OLDNEW
« no previous file with comments | « no previous file | utils/pub/path.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698