From 634e9319203004e92e0b488529ce9cb22709ca27 Mon Sep 17 00:00:00 2001 From: Chaos Date: Tue, 11 Jan 2022 21:43:59 +0100 Subject: [PATCH] Fix --- pom.xml | 5 +++++ .../java/de/chaos/swlnmngr/route/routes/LinkRoute.java | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8a47e77..3394dd2 100644 --- a/pom.xml +++ b/pom.xml @@ -92,5 +92,10 @@ commons-lang 2.6 + + commons-io + commons-io + 2.11.0 + \ No newline at end of file diff --git a/src/main/java/de/chaos/swlnmngr/route/routes/LinkRoute.java b/src/main/java/de/chaos/swlnmngr/route/routes/LinkRoute.java index 3b2fd95..debf7e8 100644 --- a/src/main/java/de/chaos/swlnmngr/route/routes/LinkRoute.java +++ b/src/main/java/de/chaos/swlnmngr/route/routes/LinkRoute.java @@ -2,6 +2,7 @@ package de.chaos.swlnmngr.route.routes; import de.chaos.swlnmngr.Main; import de.chaos.swlnmngr.config.Config; +import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; @@ -36,7 +37,13 @@ public class LinkRoute implements Route { } File link = new File(projectDir, "lib"); try { - Files.deleteIfExists(link.toPath()); + if(link.exists()) { + if(link.isDirectory()) { + FileUtils.deleteDirectory(link); + } else { + FileUtils.delete(link); + } + } Main.getLogger().debug(libsFile); Main.getLogger().debug(link); Path linkPath = Files.createSymbolicLink(link.toPath(), libsFile.toPath());