fix: changing game version without alerting incompatibility

This commit is contained in:
huanghongxun
2020-03-11 00:27:29 +08:00
parent 8fd500e931
commit ee8be3166f
12 changed files with 127 additions and 192 deletions

View File

@@ -112,7 +112,7 @@ public class DefaultDependencyManager extends AbstractDependencyManager {
return removeLibraryAsync(baseVersion.resolvePreservingPatches(repository), libraryVersion.getLibraryId())
.thenComposeAsync(version -> libraryVersion.getInstallTask(this, version))
.thenApplyAsync(baseVersion::addPatch)
.thenComposeAsync(repository::save).withStage(String.format("hmcl.install.%s:%s", libraryVersion.getLibraryId(), libraryVersion.getSelfVersion()));
.withStage(String.format("hmcl.install.%s:%s", libraryVersion.getLibraryId(), libraryVersion.getSelfVersion()));
}
public Task<Version> installLibraryAsync(Version oldVersion, Path installer) {

View File

@@ -66,7 +66,7 @@ public class DefaultGameBuilder extends GameBuilder {
stages.add(String.format("hmcl.install.%s:%s", remoteVersion.getLibraryId(), remoteVersion.getSelfVersion()));
}
return libraryTask.whenComplete(exception -> {
return libraryTask.thenComposeAsync(dependencyManager.getGameRepository()::save).whenComplete(exception -> {
if (exception != null)
dependencyManager.getGameRepository().removeVersionFromDisk(name);
}).withStagesHint(stages);