Compare commits

..

3 Commits

Author SHA1 Message Date
comp500
c0c318772b Improve file check speed, apparently Files.exists is slow 2019-09-04 03:03:29 +01:00
comp500
580408b92a Accept optional mods on the server rather than throwing an exception 2019-08-30 14:52:06 +01:00
comp500
dbdd1fb9f3 Ensure CLI is closed when update is done 2019-08-30 13:57:43 +01:00
3 changed files with 13 additions and 4 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 {
@@ -442,6 +442,9 @@ public class UpdateManager {
}
}
// Shut down the thread pool when the update is done
threadPool.shutdown();
List<IExceptionDetails> failedTasks2ElectricBoogaloo = nonFailedFirstTasks.stream().filter(t -> t.getException() != null).collect(Collectors.toList());
if (!failedTasks2ElectricBoogaloo.isEmpty()) {
errorsOccurred = true;

View File

@@ -35,8 +35,14 @@ public class CLIHandler implements IUserInterface {
}
@Override
public Future<Boolean> showOptions(List<IOptionDetails> option) {
throw new RuntimeException("Optional mods not implemented for CLI! Make sure your optional mods are only on the client side!");
public Future<Boolean> showOptions(List<IOptionDetails> options) {
for (IOptionDetails opt : options) {
opt.setOptionValue(true);
System.out.println("Warning: accepting option " + opt.getName() + " as option choosing is not implemented in the CLI");
}
CompletableFuture<Boolean> future = new CompletableFuture<>();
future.complete(false); // Can't be cancelled!
return future;
}
@Override