From 417cf0a8917db0865f4d75d0e4b860a76138c1a7 Mon Sep 17 00:00:00 2001 From: coolGi Date: Fri, 6 Oct 2023 18:02:28 +1030 Subject: [PATCH] Used .renameTo instead of .canWrite to check if file is unlocked --- .../seibel/distanthorizons/coreapi/util/jar/DeleteOnUnlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/com/seibel/distanthorizons/coreapi/util/jar/DeleteOnUnlock.java b/api/src/main/java/com/seibel/distanthorizons/coreapi/util/jar/DeleteOnUnlock.java index 3f88b3067..e9d80a10b 100644 --- a/api/src/main/java/com/seibel/distanthorizons/coreapi/util/jar/DeleteOnUnlock.java +++ b/api/src/main/java/com/seibel/distanthorizons/coreapi/util/jar/DeleteOnUnlock.java @@ -22,7 +22,7 @@ public class DeleteOnUnlock { for (int i = 0; i < 600; i++) // As it rests for around 0.1 second each loop, this should last a minute { - if (file.canWrite()) + if (file.renameTo(file)) // If it is able to be renamed, then it is unlocked and can be deleted { Files.delete(file.toPath()); break;