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 /** | 5 /** |
6 * Helper functionality to make working with IO easier. | 6 * Helper functionality to make working with IO easier. |
7 */ | 7 */ |
8 #library('pub_io'); | 8 #library('pub_io'); |
9 | 9 |
10 #import('dart:io'); | 10 #import('dart:io'); |
(...skipping 20 matching lines...) Expand all Loading... |
31 parts.removeLast(); | 31 parts.removeLast(); |
32 } else if (piece != '') { | 32 } else if (piece != '') { |
33 if (parts.length > 0 && parts.last() == '.') { | 33 if (parts.length > 0 && parts.last() == '.') { |
34 parts.removeLast(); | 34 parts.removeLast(); |
35 } | 35 } |
36 parts.add(piece); | 36 parts.add(piece); |
37 } | 37 } |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 return Strings.join(parts, Platform.pathSeparator()); | 41 return Strings.join(parts, Platform.pathSeparator); |
42 } | 42 } |
43 | 43 |
44 /** | 44 /** |
45 * Gets the basename, the file name without any leading directory path, for | 45 * Gets the basename, the file name without any leading directory path, for |
46 * [file], which can either be a [String], [File], or [Directory]. | 46 * [file], which can either be a [String], [File], or [Directory]. |
47 */ | 47 */ |
48 String basename(file) { | 48 String basename(file) { |
49 return fs.basename(_getPath(file)); | 49 return fs.basename(_getPath(file)); |
50 } | 50 } |
51 | 51 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 318 } |
319 | 319 |
320 /** | 320 /** |
321 * Gets a [Directory] for [entry], which can either already be one, or be a | 321 * Gets a [Directory] for [entry], which can either already be one, or be a |
322 * [String]. | 322 * [String]. |
323 */ | 323 */ |
324 Directory _getDirectory(entry) { | 324 Directory _getDirectory(entry) { |
325 if (entry is Directory) return entry; | 325 if (entry is Directory) return entry; |
326 return new Directory(entry); | 326 return new Directory(entry); |
327 } | 327 } |
OLD | NEW |