Skip to content

Commit 1ebfe97

Browse files
committed
Complete merge from cleanup pr
1 parent 09c58ac commit 1ebfe97

File tree

13 files changed

+43
-153
lines changed

13 files changed

+43
-153
lines changed

ios/Flutter/ephemeral/flutter_lldb_helper.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

ios/Flutter/ephemeral/flutter_lldbinit

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/backend/database/helper.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ class EntityStatCacheHelper {
99

1010
if (stat == null) {
1111
final file = fs.File.fromPath(path);
12-
final fetchedStat = EntityStat.fromFileInfo(
13-
path,
14-
await file.queryInfo().result,
15-
);
12+
final fetchedStat = EntityStat.fromFileInfo(path, await file.queryInfo().result);
1613
await set(fetchedStat);
1714
return fetchedStat;
1815
}

lib/backend/drive_provider.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class DriveProvider with ChangeNotifier {
1515

1616
List<UDisksBlockDevice> get blockDevices => List.of(_blockDevices);
1717
List<UDisksDrive> get drives => List.of(_drives);
18-
List<String> get supportedFilesystems =>
19-
List.of(_client.supportedFilesystems);
18+
List<String> get supportedFilesystems => List.of(_client.supportedFilesystems);
2019

2120
Future<void> init() async {
2221
await _client.connect();

lib/backend/entity_info.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ class EntityInfo {
6161
}
6262

6363
extension EntityInfoHelpers on EntityInfo {
64-
bool get isFile =>
65-
stat.type == EntityType.file || stat.type == EntityType.link;
64+
bool get isFile => stat.type == EntityType.file || stat.type == EntityType.link;
6665
bool get isDirectory => stat.type == EntityType.directory;
6766
}
6867

lib/backend/fetch.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class CancelableFsFetch {
3434
if (cancelled) throw CancelledException();
3535

3636
final enumeratorOp = source.getEnumerator(
37-
attributes:
38-
'standard::name,standard::type,standard::size,standard::is-hidden,time::*',
37+
attributes: 'standard::name,standard::type,standard::size,standard::is-hidden,time::*',
3938
);
4039
final enumerator = await enumeratorOp.result;
4140

lib/backend/folder_provider.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ class FolderProvider {
5151

5252
final backDir = getUserDirectory(dirNames.first)!.path.split(Platform.pathSeparator)
5353
..removeLast();
54-
folders.add(BuiltinFolder(FolderType.home, Directory(backDir.join(Platform.pathSeparator))));
54+
folders.add(
55+
BuiltinFolder(FolderType.home, fs.File.fromPath(backDir.join(Platform.pathSeparator))),
56+
);
5557

5658
for (final element in dirNames) {
5759
final type = FolderType.fromString(element);
5860
if (type == null) continue;
5961

60-
folders.add(BuiltinFolder(type, Directory(getUserDirectory(element)!.path)));
62+
folders.add(BuiltinFolder(type, fs.File.fromPath(getUserDirectory(element)!.path)));
6163
}
6264
} else {
6365
throw Exception('Platform not supported');

lib/backend/fs.dart

Lines changed: 24 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,13 @@ void initFileSystemThread() {
1212
init_io_thread();
1313
}
1414

15-
enum OperationStatus {
16-
pending,
17-
running,
18-
cancellationPending,
19-
cancelled,
20-
error,
21-
complete,
22-
}
15+
enum OperationStatus { pending, running, cancellationPending, cancelled, error, complete }
2316

2417
class Cancellable extends ChangeNotifier {
2518
Cancellable() {
26-
_cancelCallable = NativeCallable<Void Function()>.isolateLocal(
27-
notifyListeners,
28-
);
19+
_cancelCallable = NativeCallable<Void Function()>.isolateLocal(notifyListeners);
2920
_handle = cancellable_new();
30-
_cancelCallbackHandlerId = cancellable_connect(
31-
_handle,
32-
_cancelCallable.nativeFunction,
33-
);
21+
_cancelCallbackHandlerId = cancellable_connect(_handle, _cancelCallable.nativeFunction);
3422
}
3523

3624
late final Pointer<GCancellable> _handle;
@@ -60,9 +48,7 @@ abstract class BaseFileSystemOperation<Res> {
6048
_start();
6149
}
6250

63-
final ValueNotifier<OperationStatus> _status = ValueNotifier(
64-
OperationStatus.pending,
65-
);
51+
final ValueNotifier<OperationStatus> _status = ValueNotifier(OperationStatus.pending);
6652
final Completer<Res> _completer = Completer();
6753
late final Cancellable _cancellable;
6854
late final bool _implicitCancellable;
@@ -82,11 +68,7 @@ abstract class BaseFileSystemOperation<Res> {
8268
final domain = error_domain_name(_error.value).cast<Utf8>().toDartString();
8369
final message = _error.value.ref.message.cast<Utf8>().toDartString();
8470

85-
return NativeException._(
86-
domain: domain,
87-
code: _error.value.ref.code,
88-
message: message,
89-
);
71+
return NativeException._(domain: domain, code: _error.value.ref.code, message: message);
9072
}
9173

9274
void _create() {
@@ -128,8 +110,7 @@ abstract class BaseFileSystemOperation<Res> {
128110
}
129111
}
130112

131-
typedef _CallableCreateCallback<T> =
132-
NativeCallable Function(void Function(T) onComplete);
113+
typedef _CallableCreateCallback<T> = NativeCallable Function(void Function(T) onComplete);
133114
typedef _StartOperationCallback =
134115
void Function(
135116
Pointer<GCancellable> cancellable,
@@ -155,11 +136,7 @@ class FileSystemOperation<Res> extends BaseFileSystemOperation<Res> {
155136

156137
@override
157138
void _start() {
158-
_onStartOperation(
159-
_cancellable._handle,
160-
_completeCallable.nativeFunction,
161-
_error,
162-
);
139+
_onStartOperation(_cancellable._handle, _completeCallable.nativeFunction, _error);
163140
}
164141

165142
@override
@@ -223,12 +200,8 @@ class TransferFileOperation extends BaseFileSystemOperation<bool> {
223200
@override
224201
void _create() {
225202
super._create();
226-
_progressCallable = NativeCallable<Void Function(Long, Long)>.listener(
227-
_onProgress,
228-
);
229-
_completeCallable = NativeCallable<Void Function(Bool)>.listener(
230-
_onComplete,
231-
);
203+
_progressCallable = NativeCallable<Void Function(Long, Long)>.listener(_onProgress);
204+
_completeCallable = NativeCallable<Void Function(Bool)>.listener(_onComplete);
232205
}
233206

234207
@override
@@ -318,15 +291,14 @@ class File implements Finalizable {
318291
NativeCallable<Void Function(Pointer<GFileEnumerator>)>.listener(
319292
(Pointer<GFileEnumerator> v) => onComplete(FileEnumerator._(v)),
320293
),
321-
onStartOperation: (cancellable, onComplete, error) =>
322-
file_enumerate_children(
323-
_handle,
324-
attributes.toNativeUtf8().cast(),
325-
0,
326-
cancellable,
327-
onComplete.cast(),
328-
error,
329-
),
294+
onStartOperation: (cancellable, onComplete, error) => file_enumerate_children(
295+
_handle,
296+
attributes.toNativeUtf8().cast(),
297+
0,
298+
cancellable,
299+
onComplete.cast(),
300+
error,
301+
),
330302
cancellable: cancellable,
331303
);
332304
}
@@ -345,10 +317,7 @@ class File implements Finalizable {
345317
);
346318
}
347319

348-
FileSystemOperation<FileInfo> queryInfo({
349-
String attributes = '*',
350-
Cancellable? cancellable,
351-
}) {
320+
FileSystemOperation<FileInfo> queryInfo({String attributes = '*', Cancellable? cancellable}) {
352321
return FileSystemOperation<FileInfo>._(
353322
target: _handle.cast(),
354323
onCreateCompleteCallable: (onComplete) =>
@@ -436,10 +405,7 @@ class FileInfo implements Finalizable {
436405

437406
List<String>? listAttributes({String? namespace}) {
438407
final namespacePtr = namespace?.toNativeUtf8();
439-
final attributes = fileinfo_list_attributes(
440-
_handle,
441-
namespacePtr?.cast() ?? nullptr,
442-
);
408+
final attributes = fileinfo_list_attributes(_handle, namespacePtr?.cast() ?? nullptr);
443409

444410
if (namespacePtr != null) calloc.free(namespacePtr);
445411
if (attributes == nullptr) return null;
@@ -472,24 +438,15 @@ extension type FileList._(Pointer<GList> _handle) {
472438
}
473439

474440
extension type FileEnumerator._(Pointer<GFileEnumerator> _handle) {
475-
FileSystemOperation<FileList?> enumerate({
476-
int fileAmount = 4,
477-
Cancellable? cancellable,
478-
}) {
441+
FileSystemOperation<FileList?> enumerate({int fileAmount = 4, Cancellable? cancellable}) {
479442
return FileSystemOperation<FileList?>._(
480443
target: _handle.cast(),
481444
onCreateCompleteCallable: (onComplete) =>
482445
NativeCallable<Void Function(Pointer<GList>)>.listener(
483-
(Pointer<GList> v) =>
484-
onComplete(v != nullptr ? FileList._(v) : null),
446+
(Pointer<GList> v) => onComplete(v != nullptr ? FileList._(v) : null),
485447
),
486-
onStartOperation: (cancellable, onComplete, error) => fileenum_next_files(
487-
_handle,
488-
fileAmount,
489-
cancellable,
490-
onComplete.cast(),
491-
error,
492-
),
448+
onStartOperation: (cancellable, onComplete, error) =>
449+
fileenum_next_files(_handle, fileAmount, cancellable, onComplete.cast(), error),
493450
cancellable: cancellable,
494451
);
495452
}
@@ -517,11 +474,7 @@ class NativeException implements Exception {
517474
final int code;
518475
final String message;
519476

520-
const NativeException._({
521-
required this.domain,
522-
required this.code,
523-
required this.message,
524-
});
477+
const NativeException._({required this.domain, required this.code, required this.message});
525478

526479
@override
527480
String toString() {

lib/backend/fs_native.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ external void obj_unref(Pointer<Void> obj);
3939
@Native<Pointer<GCancellable> Function()>()
4040
external Pointer<GCancellable> cancellable_new();
4141

42-
@Native<
43-
UnsignedLong Function(
44-
Pointer<GCancellable>,
45-
Pointer<NativeFunction<Void Function()>>,
46-
)
47-
>()
42+
@Native<UnsignedLong Function(Pointer<GCancellable>, Pointer<NativeFunction<Void Function()>>)>()
4843
external int cancellable_connect(
4944
Pointer<GCancellable> cancellable,
5045
Pointer<NativeFunction<Void Function()>> onCancel,
@@ -57,10 +52,7 @@ external void cancellable_cancel(Pointer<GCancellable> cancellable);
5752
external bool cancellable_is_cancelled(Pointer<GCancellable> cancellable);
5853

5954
@Native<Void Function(Pointer<GCancellable>, UnsignedLong)>()
60-
external void cancellable_destroy(
61-
Pointer<GCancellable> cancellable,
62-
int cancelCallbackHandlerId,
63-
);
55+
external void cancellable_destroy(Pointer<GCancellable> cancellable, int cancelCallbackHandlerId);
6456

6557
@Native<Pointer<Pointer<GError>> Function()>()
6658
external Pointer<Pointer<GError>> error_new();
@@ -221,8 +213,7 @@ external void file_enumerate_children(
221213
Pointer<Char> attributes,
222214
int flags,
223215
Pointer<GCancellable> cancellable,
224-
Pointer<NativeFunction<Void Function(Pointer<GFileEnumerator>)>>
225-
resultCallback,
216+
Pointer<NativeFunction<Void Function(Pointer<GFileEnumerator>)>> resultCallback,
226217
Pointer<Pointer<GError>> error,
227218
);
228219

lib/backend/utils.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ class Utils {
7777
directoryParts.parts..add(originParts.parts.last),
7878
originParts.separator,
7979
);
80-
return origin.move(
81-
destination: fs.File.fromPath(destinationParts.toPath()),
82-
);
80+
return origin.move(destination: fs.File.fromPath(destinationParts.toPath()));
8381
}
8482
}

0 commit comments

Comments
 (0)