优化清理硬盘逻辑

This commit is contained in:
ZhangYuheng 2024-10-08 17:29:55 +08:00
parent e5e2d065a4
commit fc048a450b

View File

@ -124,19 +124,18 @@ public class StorageMaps {
if (files == null) { if (files == null) {
return; return;
} }
if (files.length == 0) { List<String> filenames = new ArrayList<>();
for (File file : files) {
filenames.add(file.getName());
}
if (filenames.isEmpty()) {
map_folder.delete(); map_folder.delete();
continue; continue;
} }
if (files.length == 3) { if (!filenames.contains("meta.txt")) {
for (File file : files) { continue;
if (!file.getName().equals("meta.txt") && !file.getName().equals("raw.png") && !file.getName().equals("thumb.png")) { }
return; if (files.length == 3 && filenames.contains("raw.png") && filenames.contains("thumb.png") && filenames.contains("meta.txt")) {
}
}
for (File file : files) {
file.delete();
}
map_folder.delete(); map_folder.delete();
} }
} }