Improve file check speed, apparently Files.exists is slow

This commit is contained in:
comp500 2019-09-04 03:03:29 +01:00
parent 580408b92a
commit c0c318772b
2 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ class DownloadTask implements IOptionDetails, IExceptionDetails {
// Don't update files marked with preserve if they already exist on disk
if (metadata.preserve) {
if (Files.exists(destPath)) {
if (destPath.toFile().exists()) {
return;
}
}

View File

@ -161,7 +161,7 @@ public class UpdateManager {
// if isn't optional, or is optional but optionValue == true
if (!entry.getValue().isOptional || entry.getValue().optionValue) {
if (entry.getValue().cachedLocation != null) {
if (!Files.exists(Paths.get(opts.packFolder, entry.getValue().cachedLocation))) {
if (!Paths.get(opts.packFolder, entry.getValue().cachedLocation).toFile().exists()) {
invalid = true;
}
} else {