From bf8aa6850c39faf9f0c37da13a060d03098bf0b6 Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Wed, 3 Jul 2024 15:22:39 -0500 Subject: [PATCH] Changed imported name suffix to random number + UTC to prevent cases of duplicates getting deleted together --- src/MissPiggy.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MissPiggy.java b/src/MissPiggy.java index 4f81151..c0bb1a1 100644 --- a/src/MissPiggy.java +++ b/src/MissPiggy.java @@ -399,8 +399,12 @@ public class MissPiggy implements ActionListener { try { JSONObject json = new JSONObject(new ZipFile(selectedFile.getAbsolutePath()).getComment()); // intentionally trigger exception if file is random BS if ((int)json.get("loaderversion") <= Main.vint) { + int min=0, max=9; + int rand_int = (int)(Math.random()*((max-min)+1))+min; + int rand_int2 = (int)(Math.random()*((max-min)+1))+min; + int rand_int3 = (int)(Math.random()*((max-min)+1))+min; Path importDestination = Paths.get(System.getProperty("user.home") + "/.firestar/mods/" - + selectedFile.getName() + "_" + Main.Mods.size() + ".zip"); + + selectedFile.getName() + "_" + rand_int + rand_int2 + rand_int3 + System.currentTimeMillis() + ".zip"); Files.copy(Paths.get(selectedFile.getPath()), importDestination, StandardCopyOption.REPLACE_EXISTING); String importDestinationName = importDestination.toFile().getName();