| 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 library pub.package; | 5 library pub.package; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:barback/barback.dart'; | 9 import 'package:barback/barback.dart'; |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 /// [recursive] is true, this will return all files beneath that path; | 183 /// [recursive] is true, this will return all files beneath that path; |
| 184 /// otherwise, it will only return files one level beneath it. | 184 /// otherwise, it will only return files one level beneath it. |
| 185 /// | 185 /// |
| 186 /// If [useGitIgnore] is passed, this will take the .gitignore rules into | 186 /// If [useGitIgnore] is passed, this will take the .gitignore rules into |
| 187 /// account if the package's root directory is a Git repository. | 187 /// account if the package's root directory is a Git repository. |
| 188 /// | 188 /// |
| 189 /// Note that the returned paths won't always be beneath [dir]. To safely | 189 /// Note that the returned paths won't always be beneath [dir]. To safely |
| 190 /// convert them to paths relative to the package root, use [relative]. | 190 /// convert them to paths relative to the package root, use [relative]. |
| 191 List<String> listFiles({String beneath, bool recursive: true, | 191 List<String> listFiles({String beneath, bool recursive: true, |
| 192 bool useGitIgnore: false}) { | 192 bool useGitIgnore: false}) { |
| 193 // An in-memory package has no files. |
| 194 if (dir == null) return []; |
| 195 |
| 193 if (beneath == null) { | 196 if (beneath == null) { |
| 194 beneath = dir; | 197 beneath = dir; |
| 195 } else { | 198 } else { |
| 196 beneath = p.join(dir, beneath); | 199 beneath = p.join(dir, beneath); |
| 197 } | 200 } |
| 198 | 201 |
| 199 if (!dirExists(beneath)) return []; | 202 if (!dirExists(beneath)) return []; |
| 200 | 203 |
| 201 // This is used in some performance-sensitive paths and can list many, many | 204 // This is used in some performance-sensitive paths and can list many, many |
| 202 // files. As such, it leans more havily towards optimization as opposed to | 205 // files. As such, it leans more havily towards optimization as opposed to |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 416 |
| 414 bool operator ==(other) { | 417 bool operator ==(other) { |
| 415 // TODO(rnystrom): We're assuming here that we don't need to delve into the | 418 // TODO(rnystrom): We're assuming here that we don't need to delve into the |
| 416 // description. | 419 // description. |
| 417 return other is PackageDep && | 420 return other is PackageDep && |
| 418 other.name == name && | 421 other.name == name && |
| 419 other.source == source && | 422 other.source == source && |
| 420 other.constraint == constraint; | 423 other.constraint == constraint; |
| 421 } | 424 } |
| 422 } | 425 } |
| OLD | NEW |