From 3defbbe725a49adab77671d12b65ce3d00376174 Mon Sep 17 00:00:00 2001 From: Prototik Date: Sun, 31 May 2015 19:04:51 +0700 Subject: [PATCH] Fix symlink recreation --- src/main/java/kcauldron/updater/KCauldronUpdater.java | 4 +--- src/main/java/kcauldron/updater/KVersionRetriever.java | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/kcauldron/updater/KCauldronUpdater.java b/src/main/java/kcauldron/updater/KCauldronUpdater.java index 51d0229..d97e65d 100644 --- a/src/main/java/kcauldron/updater/KCauldronUpdater.java +++ b/src/main/java/kcauldron/updater/KCauldronUpdater.java @@ -174,9 +174,7 @@ public class KCauldronUpdater implements Runnable { mSender.sendMessage(ChatColor.RED + "Create symlink " + ChatColor.GOLD + symlinkPath.getAbsolutePath()); } - if (symlinkPath.exists()) { - symlinkPath.delete(); - } + Files.deleteIfExists(symlinkPath.toPath()); Files.createSymbolicLink(symlinkPath.toPath(), newPath.toPath()); } } catch (Exception e) { diff --git a/src/main/java/kcauldron/updater/KVersionRetriever.java b/src/main/java/kcauldron/updater/KVersionRetriever.java index c0b98d4..e40696f 100644 --- a/src/main/java/kcauldron/updater/KVersionRetriever.java +++ b/src/main/java/kcauldron/updater/KVersionRetriever.java @@ -81,10 +81,8 @@ public class KVersionRetriever implements Runnable, UncaughtExceptionHandler { JSONObject json = (JSONObject) sParser.parse(new InputStreamReader( response.getEntity().getContent())); String version = (String) json.get("version"); - if (DEBUG) { - sLogger.info("Got the latest version: %s", version); - sLogger.info("Current version is %s", sCurrentVersion); - } + sLogger.info("Got the latest version: %s", version); + sLogger.info("Current version is %s", sCurrentVersion); if (!sCurrentVersion.equals(version)) { mCallback.newVersion(sCurrentVersion, version); } else {