Fix: keep not completed Curse modpack game version

This commit is contained in:
huanghongxun 2019-10-10 16:39:27 +08:00
parent 529c4ed420
commit 944d88b8af
2 changed files with 7 additions and 4 deletions

View File

@ -107,9 +107,6 @@ public final class ModpackHelper {
if (ex instanceof CurseCompletionException && !(ex.getCause() instanceof FileNotFoundException)) {
success.run();
// This is tolerable and we will not delete the game
} else {
HMCLGameRepository repository = profile.getRepository();
repository.removeVersionFromDisk(name);
}
};

View File

@ -32,6 +32,7 @@ import org.jackhuang.hmcl.util.gson.JsonUtils;
import org.jackhuang.hmcl.util.io.FileUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collection;
import java.util.LinkedList;
@ -84,7 +85,12 @@ public final class CurseInstallTask extends Task<Void> {
dependents.add(builder.buildAsync());
onDone().register(event -> {
if (event.isFailed()) repository.removeVersionFromDisk(name);
Exception ex = event.getTask().getException();
if (event.isFailed()) {
if (!(ex instanceof CurseCompletionException) || ex.getCause() instanceof FileNotFoundException) {
repository.removeVersionFromDisk(name);
}
}
});
ModpackConfiguration<CurseManifest> config = null;