| OLD | NEW |
| 1 library io; | 1 library io; |
| 2 /// This is a helper library to make working with io easier. | 2 /// This is a helper library to make working with io easier. |
| 3 // TODO(janicejl): listDir, canonicalize, resolveLink, and linkExists are from | 3 // TODO(janicejl): listDir, canonicalize, resolveLink, and linkExists are from |
| 4 // pub/lib/src/io.dart. If the io.dart file becomes a package, should remove | 4 // pub/lib/src/io.dart. If the io.dart file becomes a package, should remove |
| 5 // copy of the functions. | 5 // copy of the functions. |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'package:path/path.dart' as path; | 9 import 'package:pathos/path.dart' as path; |
| 10 | 10 |
| 11 /// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory | 11 /// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory |
| 12 /// contents (defaults to `false`). If [includeHidden] is `true`, includes files | 12 /// contents (defaults to `false`). If [includeHidden] is `true`, includes files |
| 13 /// and directories beginning with `.` (defaults to `false`). | 13 /// and directories beginning with `.` (defaults to `false`). |
| 14 /// | 14 /// |
| 15 /// The returned paths are guaranteed to begin with [dir]. | 15 /// The returned paths are guaranteed to begin with [dir]. |
| 16 List<String> listDir(String dir, {bool recursive: false, | 16 List<String> listDir(String dir, {bool recursive: false, |
| 17 bool includeHidden: false}) { | 17 bool includeHidden: false}) { |
| 18 List<String> doList(String dir, Set<String> listedDirectories) { | 18 List<String> doList(String dir, Set<String> listedDirectories) { |
| 19 var contents = <String>[]; | 19 var contents = <String>[]; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 seen.add(link); | 142 seen.add(link); |
| 143 link = path.normalize(path.join( | 143 link = path.normalize(path.join( |
| 144 path.dirname(link), new Link(link).targetSync())); | 144 path.dirname(link), new Link(link).targetSync())); |
| 145 } | 145 } |
| 146 return link; | 146 return link; |
| 147 } | 147 } |
| 148 | 148 |
| 149 /// Returns whether [link] exists on the file system. This will return `true` | 149 /// Returns whether [link] exists on the file system. This will return `true` |
| 150 /// for any symlink, regardless of what it points at or whether it's broken. | 150 /// for any symlink, regardless of what it points at or whether it's broken. |
| 151 bool linkExists(String link) => new Link(link).existsSync(); | 151 bool linkExists(String link) => new Link(link).existsSync(); |
| OLD | NEW |