[FEATURE] Логгирование изменений в HashedDir.

This commit is contained in:
Zaxar163 2019-07-19 18:49:59 +03:00
parent 6db6e4c31e
commit f4105432ff

View file

@ -969,7 +969,22 @@ public void syncUpdatesDir(Collection<String> dirs) throws IOException {
LogHelper.info("Syncing '%s' update dir", name); LogHelper.info("Syncing '%s' update dir", name);
HashedDir updateHDir = new HashedDir(updateDir, null, true, true); HashedDir updateHDir = new HashedDir(updateDir, null, true, true);
if (work && config.zipDownload) processUpdate(updateDir, updateHDir, name); 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); updatesDirMap = Collections.unmodifiableMap(newUpdatesDirMap);
@ -999,7 +1014,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
} }
return HashedDir.WalkAction.CONTINUE; return HashedDir.WalkAction.CONTINUE;
}); });
} }
public void restart() { public void restart() {