Delete version folder when installing canceled

This commit is contained in:
huangyuhui
2018-02-02 15:38:55 +08:00
parent ad175fd2f2
commit e4bd1c758f
2 changed files with 9 additions and 0 deletions

View File

@@ -25,6 +25,7 @@ import org.jackhuang.hmcl.util.AutoTypingMap;
import org.jackhuang.hmcl.util.Constants;
import org.jackhuang.hmcl.util.ExceptionalFunction;
import java.io.IOException;
import java.util.function.Function;
/**
@@ -69,6 +70,12 @@ public class DefaultGameBuilder extends GameBuilder {
if (toolVersions.containsKey("optifine"))
result = result.then(libraryTaskHelper(gameVersion, "optifine"));
return result;
}).finalized(new Task() {
@Override
public void execute() {
if (!isDependentsSucceeded())
dependencyManager.getGameRepository().getVersionRoot(name).delete();
}
});
}