11import 'dart:async' ;
2- import 'dart:collection' ;
32
43import 'package:files/backend/database/model.dart' ;
54import 'package:files/backend/entity_info.dart' ;
@@ -35,17 +34,22 @@ class CancelableFsFetch {
3534 Future <void > startFetch () async {
3635 if (cancelled) throw CancelledException ();
3736
38- final enumeratorOp = source.getEnumerator ();
37+ final enumeratorOp = source.getEnumerator (
38+ attributes:
39+ 'standard::name,standard::type,standard::size,standard::is-hidden,time::*' ,
40+ );
3941 final enumerator = await enumeratorOp.result;
4042
4143 onProgressChange? .call (0.0 );
4244
43- final directories = SplayTreeSet <EntityInfo >(
44- (a, b) => _sort (a, b, isDirectory: true )! ,
45- );
46- final files = SplayTreeSet <EntityInfo >(
47- (a, b) => _sort (a, b, isDirectory: false )! ,
48- );
45+ // final directories = SortedList<EntityInfo>(
46+ // (a, b) => _sort(a, b, isDirectory: true)!,
47+ // );
48+ // final files = SortedList<EntityInfo>(
49+ // (a, b) => _sort(a, b, isDirectory: false)!,
50+ // );
51+ final directories = < EntityInfo > [];
52+ final files = < EntityInfo > [];
4953
5054 while (true ) {
5155 final enumerateOp = enumerator.enumerate (cancellable: cancellable);
@@ -71,6 +75,8 @@ class CancelableFsFetch {
7175 }
7276 fileList.destroy ();
7377 }
78+ directories.sort ((a, b) => _sort (a, b, isDirectory: true )! );
79+ files.sort ((a, b) => _sort (a, b, isDirectory: false )! );
7480
7581 if (! cancelled) onFetched.call ([...directories, ...files]);
7682 }
@@ -95,7 +101,9 @@ class CancelableFsFetch {
95101 return 0 ;
96102 case 3 :
97103 if (isDirectory) {
98- return 0 ;
104+ return Utils .getEntityName (
105+ item1.path.toLowerCase (),
106+ ).compareTo (Utils .getEntityName (item2.path.toLowerCase ()));
99107 } else {
100108 return item1.stat.size.compareTo (item2.stat.size);
101109 }
0 commit comments