From b500fecadf129c211be1c542760f9d81655e7899 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Mon, 11 Nov 2024 08:53:29 +0000 Subject: [PATCH] Added ensured overwrite --- .../synchronisation/ApacheCommonsIOSynchroniser.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/solutions/reslate/entertainment/spigotresourcesync/synchronisation/ApacheCommonsIOSynchroniser.java b/src/main/java/solutions/reslate/entertainment/spigotresourcesync/synchronisation/ApacheCommonsIOSynchroniser.java index 36f0d62..686a007 100644 --- a/src/main/java/solutions/reslate/entertainment/spigotresourcesync/synchronisation/ApacheCommonsIOSynchroniser.java +++ b/src/main/java/solutions/reslate/entertainment/spigotresourcesync/synchronisation/ApacheCommonsIOSynchroniser.java @@ -15,6 +15,11 @@ public class ApacheCommonsIOSynchroniser implements Synchroniser { source = Path.of(root.getPath(), dest.getPath()).toFile(); } + if (source.exists() && dest.exists()) { + dest.delete(); + // Fixes an issue where sometimes, Apache Commons IO will fail to overwrite. + } + if (source.isDirectory()) { if (dest.isDirectory()) { FileUtils.copyDirectory(source, dest);