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

Unified Diff: lib/src/list_tree.dart

Issue 1773293002: Fix case-insensitive absolute listing. (Closed) Base URL: git@github.com:dart-lang/glob@master
Patch Set: Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | test/glob_test.dart » ('j') | test/glob_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/list_tree.dart
diff --git a/lib/src/list_tree.dart b/lib/src/list_tree.dart
index eff8c7b74394183dc5036790c029cb07fc92e70f..57ed067b85da7e562122c2e24dc8221bfed2267b 100644
--- a/lib/src/list_tree.dart
+++ b/lib/src/list_tree.dart
@@ -314,7 +314,7 @@ class _ListTreeNode {
Stream<FileSystemEntity> list(String dir, {bool followLinks: true}) {
if (isRecursive) {
return new Directory(dir).list(recursive: true, followLinks: followLinks)
- .where((entity) => _matches(entity.path.substring(dir.length + 1)));
+ .where((entity) => _matches(p.relative(entity.path, from: dir)));
Bob Nystrom 2016/03/08 21:40:31 What's the performance impact of this? It might b
nweiz 2016/03/08 22:01:15 I doubt the performance impact is that high—it's h
}
var resultPool = new StreamPool();
@@ -333,7 +333,7 @@ class _ListTreeNode {
var resultController = new StreamController(sync: true);
resultPool.add(resultController.stream);
new Directory(dir).list(followLinks: followLinks).listen((entity) {
- var basename = entity.path.substring(dir.length + 1);
+ var basename = p.relative(entity.path, from: dir);
if (_matches(basename)) resultController.add(entity);
children.forEach((sequence, child) {
@@ -368,7 +368,7 @@ class _ListTreeNode {
if (isRecursive) {
return new Directory(dir)
.listSync(recursive: true, followLinks: followLinks)
- .where((entity) => _matches(entity.path.substring(dir.length + 1)));
+ .where((entity) => _matches(p.relative(entity.path, from: dir)));
}
// Don't spawn extra [Directory.listSync] calls when we already know exactly
@@ -383,7 +383,7 @@ class _ListTreeNode {
return new Directory(dir).listSync(followLinks: followLinks)
.expand((entity) {
var entities = [];
- var basename = entity.path.substring(dir.length + 1);
+ var basename = p.relative(entity.path, from: dir);
if (_matches(basename)) entities.add(entity);
if (entity is! Directory) return entities;
« no previous file with comments | « CHANGELOG.md ('k') | test/glob_test.dart » ('j') | test/glob_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698