mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-19 14:33:04 +03:00
[FIX] Нормальная проверка размера.
This commit is contained in:
parent
56e6403acd
commit
4eeae3e96a
1 changed files with 10 additions and 1 deletions
|
@ -3,12 +3,14 @@
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import pro.gravit.launcher.Launcher;
|
import pro.gravit.launcher.Launcher;
|
||||||
import pro.gravit.launcher.LauncherAPI;
|
import pro.gravit.launcher.LauncherAPI;
|
||||||
|
@ -210,7 +212,7 @@ public UpdateRequestEvent requestDo(StandartClientWebSocketService service) thro
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
LogHelper.error(ex);
|
LogHelper.error(ex);
|
||||||
}
|
}
|
||||||
if (entry.size() < IOHelper.MB16) {
|
if (getPathed(name, e.hdir).size() < IOHelper.MB16) {
|
||||||
adds.add(new ListDownloader.DownloadTask(path, -1, true));
|
adds.add(new ListDownloader.DownloadTask(path, -1, true));
|
||||||
return HashedDir.WalkAction.SKIP_DIR;
|
return HashedDir.WalkAction.SKIP_DIR;
|
||||||
}
|
}
|
||||||
|
@ -310,4 +312,11 @@ private void updateState(String filePath, long fileDownloaded, long fileSize) {
|
||||||
stateCallback.call(new State(filePath, fileDownloaded, fileSize,
|
stateCallback.call(new State(filePath, fileDownloaded, fileSize,
|
||||||
totalDownloaded, totalSize, Duration.between(startTime, Instant.now())));
|
totalDownloaded, totalSize, Duration.between(startTime, Instant.now())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HashedEntry getPathed(String path, HashedDir in) {
|
||||||
|
String[] parts = path.split(IOHelper.CROSS_SEPARATOR);
|
||||||
|
HashedEntry current = in;
|
||||||
|
for (String part : parts) current = ((HashedDir) current).getEntry(part);
|
||||||
|
return current;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue