mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Не реагируем если изменились только директории
This commit is contained in:
parent
05539133cb
commit
76661305af
1 changed files with 5 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
import ru.gravit.launcher.hasher.DirWatcher;
|
import ru.gravit.launcher.hasher.DirWatcher;
|
||||||
import ru.gravit.launcher.hasher.FileNameMatcher;
|
import ru.gravit.launcher.hasher.FileNameMatcher;
|
||||||
import ru.gravit.launcher.hasher.HashedDir;
|
import ru.gravit.launcher.hasher.HashedDir;
|
||||||
|
import ru.gravit.launcher.hasher.HashedEntry;
|
||||||
import ru.gravit.launcher.managers.ClientGsonManager;
|
import ru.gravit.launcher.managers.ClientGsonManager;
|
||||||
import ru.gravit.launcher.profiles.ClientProfile;
|
import ru.gravit.launcher.profiles.ClientProfile;
|
||||||
import ru.gravit.launcher.profiles.PlayerProfile;
|
import ru.gravit.launcher.profiles.PlayerProfile;
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
public final class ClientLauncher {
|
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);
|
HashedDir.Diff diff = hdir.diff(currentHDir, matcher);
|
||||||
if (!diff.isSame())
|
if (!diff.isSame())
|
||||||
{
|
{
|
||||||
|
AtomicBoolean isFoundFile = new AtomicBoolean(false);
|
||||||
diff.extra.walk(File.separator, (e,k,v) -> {
|
diff.extra.walk(File.separator, (e,k,v) -> {
|
||||||
|
if(v.getType().equals(HashedEntry.Type.FILE)) isFoundFile.set(true);
|
||||||
LogHelper.error("Extra %s", e);
|
LogHelper.error("Extra %s", e);
|
||||||
});
|
});
|
||||||
diff.mismatch.walk(File.separator, (e,k,v) -> {
|
diff.mismatch.walk(File.separator, (e,k,v) -> {
|
||||||
|
if(v.getType().equals(HashedEntry.Type.FILE)) isFoundFile.set(true);
|
||||||
LogHelper.error("Mismatch %s", e);
|
LogHelper.error("Mismatch %s", e);
|
||||||
});
|
});
|
||||||
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
|
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
|
||||||
|
|
Loading…
Reference in a new issue