From 42560ebc436d3c8010edf42b380962e6e61908b3 Mon Sep 17 00:00:00 2001 From: LatvianModder Date: Mon, 16 Oct 2023 14:08:40 +0300 Subject: [PATCH] Dont load hidden system files like thumbs.db and .ds_store in resource packs --- .../mods/kubejs/script/data/GeneratedResourcePack.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/dev/latvian/mods/kubejs/script/data/GeneratedResourcePack.java b/common/src/main/java/dev/latvian/mods/kubejs/script/data/GeneratedResourcePack.java index 7781058ce..01c7dc1e7 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/script/data/GeneratedResourcePack.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/script/data/GeneratedResourcePack.java @@ -59,9 +59,11 @@ public Map getGenerated() { } for (var path : Files.walk(dir).filter(Files::isRegularFile).filter(Files::isReadable).toList()) { - var pathStr = dir.relativize(path).toString().replace('\\', '/'); + var pathStr = dir.relativize(path).toString().replace('\\', '/').toLowerCase(); + int sindex = pathStr.lastIndexOf('/'); + var fileName = sindex == -1 ? pathStr : pathStr.substring(sindex + 1); - if (pathStr.endsWith(".zip")) { + if (fileName.endsWith(".zip") || fileName.equals(".ds_store") || fileName.equals("thumbs.db") || fileName.equals("desktop.ini") || Files.isHidden(path)) { continue; }