mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 08:08:14 -06:00
Extracted to function and added check if dir exists
This commit is contained in:
@@ -85,6 +85,16 @@ class FileService {
|
||||
await scanDir?.delete(recursive: true);
|
||||
await tempDir.delete(recursive: true);
|
||||
}
|
||||
|
||||
static Future<void> clearDirectoryContent(PaperlessDirectoryType type) async {
|
||||
final dir = await getDirectory(type);
|
||||
|
||||
if (dir == null || !(await dir.exists())) {
|
||||
return;
|
||||
}
|
||||
|
||||
await Future.wait(dir.listSync().map((item) => item.delete()));
|
||||
}
|
||||
}
|
||||
|
||||
enum PaperlessDirectoryType {
|
||||
|
||||
Reference in New Issue
Block a user