Delete version folder when installing canceled
This commit is contained in:
@@ -68,6 +68,8 @@ public interface TaskExecutorDialogWizardDisplayer extends AbstractWizardDisplay
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
if (e.getLastException() == null)
|
||||
return;
|
||||
String appendix = StringUtils.getStackTrace(e.getLastException());
|
||||
if (settings.containsKey("failure_message") && settings.get("failure_message") instanceof String)
|
||||
JFXUtilities.runInFX(() -> Controllers.dialog(appendix, (String) settings.get("failure_message"), MessageBox.ERROR_MESSAGE, () -> Controllers.navigate(null)));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user