Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 library io; | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
|
Alan Knight
2014/03/17 17:31:57
Shouldn't these all be 2014?
kevmoo
2014/03/17 17:45:53
Done.
| |
| 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. | |
| 4 | |
| 2 /// This is a helper library to make working with io easier. | 5 /// This is a helper library to make working with io easier. |
| 6 library docgen.io; | |
| 7 | |
| 3 // TODO(janicejl): listDir, canonicalize, resolveLink, and linkExists are from | 8 // 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 | 9 // pub/lib/src/io.dart. If the io.dart file becomes a package, should remove |
| 5 // copy of the functions. | 10 // copy of the functions. |
| 6 | 11 |
| 7 import 'dart:collection'; | 12 import 'dart:collection'; |
| 8 import 'dart:io'; | 13 import 'dart:io'; |
| 9 import 'package:path/path.dart' as path; | 14 import 'package:path/path.dart' as path; |
| 10 | 15 |
| 11 /// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory | 16 /// Lists the contents of [dir]. If [recursive] is `true`, lists subdirectory |
| 12 /// contents (defaults to `false`). If [includeHidden] is `true`, includes files | 17 /// contents (defaults to `false`). If [includeHidden] is `true`, includes files |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 while (linkExists(link) && !seen.contains(link)) { | 146 while (linkExists(link) && !seen.contains(link)) { |
| 142 seen.add(link); | 147 seen.add(link); |
| 143 link = path.normalize(path.join( | 148 link = path.normalize(path.join( |
| 144 path.dirname(link), new Link(link).targetSync())); | 149 path.dirname(link), new Link(link).targetSync())); |
| 145 } | 150 } |
| 146 return link; | 151 return link; |
| 147 } | 152 } |
| 148 | 153 |
| 149 /// Returns whether [link] exists on the file system. This will return `true` | 154 /// 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. | 155 /// for any symlink, regardless of what it points at or whether it's broken. |
| 151 bool linkExists(String link) => new Link(link).existsSync(); | 156 bool linkExists(String link) => new Link(link).existsSync(); |
| OLD | NEW |