From fc048a450b83d91e34c473a8da833d79b1d77559 Mon Sep 17 00:00:00 2001 From: ZhangYuheng Date: Tue, 8 Oct 2024 17:29:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=85=E7=90=86=E7=A1=AC?= =?UTF-8?q?=E7=9B=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/lunadeer/colorfulmap/StorageMaps.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/cn/lunadeer/colorfulmap/StorageMaps.java b/src/main/java/cn/lunadeer/colorfulmap/StorageMaps.java index 1acd9d9..8de4e90 100644 --- a/src/main/java/cn/lunadeer/colorfulmap/StorageMaps.java +++ b/src/main/java/cn/lunadeer/colorfulmap/StorageMaps.java @@ -124,19 +124,18 @@ public class StorageMaps { if (files == null) { return; } - if (files.length == 0) { + List filenames = new ArrayList<>(); + for (File file : files) { + filenames.add(file.getName()); + } + if (filenames.isEmpty()) { map_folder.delete(); continue; } - if (files.length == 3) { - for (File file : files) { - if (!file.getName().equals("meta.txt") && !file.getName().equals("raw.png") && !file.getName().equals("thumb.png")) { - return; - } - } - for (File file : files) { - file.delete(); - } + if (!filenames.contains("meta.txt")) { + continue; + } + if (files.length == 3 && filenames.contains("raw.png") && filenames.contains("thumb.png") && filenames.contains("meta.txt")) { map_folder.delete(); } }