From f4105432ff51410ee13bb8d1aac847bc5003ee2c Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Fri, 19 Jul 2019 18:49:59 +0300 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=9B=D0=BE=D0=B3=D0=B3=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20HashedDir.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pro/gravit/launchserver/LaunchServer.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java index 4bc25cf1..d8870755 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/LaunchServer.java @@ -969,7 +969,22 @@ public void syncUpdatesDir(Collection dirs) throws IOException { LogHelper.info("Syncing '%s' update dir", name); HashedDir updateHDir = new HashedDir(updateDir, null, true, true); if (work && config.zipDownload) processUpdate(updateDir, updateHDir, name); - newUpdatesDirMap.put(name, updateHDir); + HashedDir old = newUpdatesDirMap.put(name, updateHDir); + if (old != null) { + HashedDir.Diff diff = old.diff(updateHDir, null); + diff.extra.walk(IOHelper.CROSS_SEPARATOR, (String path, String namef, HashedEntry entry) -> { + if (entry.getType().equals(HashedEntry.Type.FILE)) { + LogHelper.info("Modified/added: " + path); + } + return HashedDir.WalkAction.CONTINUE; + }); + diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (String path, String namef, HashedEntry entry) -> { + if (entry.getType().equals(HashedEntry.Type.FILE)) { + LogHelper.info("Removed: " + path); + } + return HashedDir.WalkAction.CONTINUE; + }); + } } } updatesDirMap = Collections.unmodifiableMap(newUpdatesDirMap); @@ -999,7 +1014,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO } return HashedDir.WalkAction.CONTINUE; }); - } public void restart() {