mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] Выключен старый костыль и включено использование флага
This commit is contained in:
parent
1e77d6cc66
commit
ac9ff4918a
3 changed files with 13 additions and 18 deletions
|
@ -5,7 +5,6 @@
|
|||
import ru.gravit.launcher.gui.JSRuntimeProvider;
|
||||
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;
|
||||
|
@ -22,7 +21,6 @@
|
|||
import ru.gravit.utils.helper.JVMHelper.OS;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ProcessBuilder.Redirect;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
|
@ -38,7 +36,6 @@
|
|||
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 {
|
||||
private static final class ClassPathFileVisitor extends SimpleFileVisitor<Path> {
|
||||
|
@ -545,18 +542,16 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
|
|||
HashedDir currentHDir = new HashedDir(dir, matcher, true, digest);
|
||||
HashedDir.Diff diff = hdir.diff(currentHDir, matcher);
|
||||
if (!diff.isSame()) {
|
||||
AtomicBoolean isFoundFile = new AtomicBoolean(false);
|
||||
/*AtomicBoolean isFoundFile = new AtomicBoolean(false);
|
||||
diff.extra.walk(File.separator, (e,k,v) -> {
|
||||
if(v.getType().equals(HashedEntry.Type.FILE)) { LogHelper.error("Extra file %s", e); isFoundFile.set(true); }
|
||||
//else LogHelper.error("Extra %s", e);
|
||||
return HashedDir.WalkAction.CONTINUE;
|
||||
else 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)) { LogHelper.error("Mismatch file %s", e); isFoundFile.set(true); }
|
||||
//else LogHelper.error("Mismatch %s", e);
|
||||
return HashedDir.WalkAction.CONTINUE;
|
||||
else LogHelper.error("Mismatch %s", e);
|
||||
});
|
||||
if(isFoundFile.get())
|
||||
if(isFoundFile.get())*/
|
||||
throw new SecurityException(String.format("Forbidden modification: '%s'", IOHelper.getFileName(dir)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,15 +87,12 @@ public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff
|
|||
{
|
||||
IOHelper.transfer(input, source);
|
||||
}
|
||||
removed.add(path.replace('\\', '/'));
|
||||
entry.flag = true;
|
||||
//removed.add(path.replace('\\', '/'));
|
||||
}
|
||||
}
|
||||
return HashedDir.WalkAction.CONTINUE;
|
||||
});
|
||||
for(String rem : removed)
|
||||
{
|
||||
diff.mismatch.removeR(rem);
|
||||
}
|
||||
}
|
||||
}
|
||||
public Path tryFind(NewLauncherSettings.HashedStoreEntry en, HashedFile file) throws IOException
|
||||
|
|
|
@ -194,9 +194,12 @@ public UpdateRequestEvent requestDo(StandartClientWebSocketService service) thro
|
|||
if(controller != null) controller.preDownload(this, e, adds);
|
||||
diff.mismatch.walk(IOHelper.CROSS_SEPARATOR, (path, name, entry) -> {
|
||||
if (entry.getType().equals(HashedEntry.Type.FILE)) {
|
||||
HashedFile file = (HashedFile) entry;
|
||||
totalSize += file.size;
|
||||
adds.add(new ListDownloader.DownloadTask(path, file.size));
|
||||
if(!entry.flag)
|
||||
{
|
||||
HashedFile file = (HashedFile) entry;
|
||||
totalSize += file.size;
|
||||
adds.add(new ListDownloader.DownloadTask(path, file.size));
|
||||
}
|
||||
} else if (entry.getType().equals(HashedEntry.Type.DIR)) {
|
||||
try {
|
||||
Files.createDirectories(dir.resolve(path));
|
||||
|
|
Loading…
Reference in a new issue