mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
20 lines
415 B
Dart
20 lines
415 B
Dart
import 'dart:io';
|
|
|
|
extension FileSystemEntityExt on FileSystemEntity {
|
|
Future<void> tryDel({bool recursive = false}) async {
|
|
try {
|
|
await delete(recursive: recursive);
|
|
} catch (_) {}
|
|
}
|
|
}
|
|
|
|
extension DirectoryExt on Directory {
|
|
Future<bool> lengthGte(int length) async {
|
|
int count = 0;
|
|
await for (final _ in list()) {
|
|
if (++count == length) return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|