[FIX] Не реагируем если изменились только директории

This commit is contained in:
Gravit 2019-04-27 19:44:48 +07:00
parent 05539133cb
commit 76661305af
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -6,6 +6,7 @@
import ru.gravit.launcher.hasher.DirWatcher;
import ru.gravit.launcher.hasher.FileNameMatcher;
import ru.gravit.launcher.hasher.HashedDir;
import ru.gravit.launcher.hasher.HashedEntry;
import ru.gravit.launcher.managers.ClientGsonManager;
import ru.gravit.launcher.profiles.ClientProfile;
import ru.gravit.launcher.profiles.PlayerProfile;
@ -35,6 +36,7 @@
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.PosixFilePermission;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
public final class ClientLauncher {
@ -541,10 +543,13 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
HashedDir.Diff diff = hdir.diff(currentHDir, matcher);
if (!diff.isSame())
{
AtomicBoolean isFoundFile = new AtomicBoolean(false);
diff.extra.walk(File.separator, (e,k,v) -> {
if(v.getType().equals(HashedEntry.Type.FILE)) isFoundFile.set(true);
LogHelper.error("Extra %s", e);
});
diff.mismatch.walk(File.separator, (e,k,v) -> {
if(v.getType().equals(HashedEntry.Type.FILE)) isFoundFile.set(true);
LogHelper.error("Mismatch %s", e);
});
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));