Skip to content

Commit

Permalink
Fix #3006
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed May 5, 2024
1 parent df953e5 commit bb4f87f
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import javafx.scene.layout.*;
import javafx.scene.text.Text;
import javafx.stage.FileChooser;
import org.jackhuang.hmcl.game.*;
import org.jackhuang.hmcl.game.GameDirectoryType;
import org.jackhuang.hmcl.game.HMCLGameRepository;
import org.jackhuang.hmcl.game.ProcessPriority;
import org.jackhuang.hmcl.setting.*;
import org.jackhuang.hmcl.task.Schedulers;
import org.jackhuang.hmcl.task.Task;
Expand Down Expand Up @@ -184,7 +186,7 @@ public VersionSettingsPage(boolean globalSetting) {
gameDirSublist = new ComponentSublist();
gameDirSublist.getContent().add(gameDirItem);
gameDirSublist.setTitle(i18n("settings.game.working_directory"));
gameDirSublist.setHasSubtitle(true);
gameDirSublist.setHasSubtitle(versionId != null);
gameDirItem.disableProperty().bind(modpack);
gameDirCustomOption = new MultiFileItem.FileOption<>(i18n("settings.custom"), GameDirectoryType.CUSTOM)
.setChooserTitle(i18n("settings.game.working_directory.choose"))
Expand Down Expand Up @@ -609,14 +611,14 @@ private void initJavaSubtitle() {
}

Task.composeAsync(Schedulers.javafx(), () -> {
if (versionId == null) {
return versionSetting.getJavaVersion(GameVersionNumber.unknown(), null);
} else {
return versionSetting.getJavaVersion(
GameVersionNumber.asGameVersion(profile.getRepository().getGameVersion(versionId)),
profile.getRepository().getVersion(versionId));
}
}).thenAcceptAsync(Schedulers.javafx(), javaVersion -> javaSublist.setSubtitle(Optional.ofNullable(javaVersion)
if (versionId == null) {
return versionSetting.getJavaVersion(GameVersionNumber.unknown(), null);
} else {
return versionSetting.getJavaVersion(
GameVersionNumber.asGameVersion(profile.getRepository().getGameVersion(versionId)),
profile.getRepository().getVersion(versionId));
}
}).thenAcceptAsync(Schedulers.javafx(), javaVersion -> javaSublist.setSubtitle(Optional.ofNullable(javaVersion)
.map(JavaVersion::getBinary).map(Path::toString).orElseGet(() ->
autoSelected ? i18n("settings.game.java_directory.auto.not_found") : i18n("settings.game.java_directory.invalid"))))
.start();
Expand Down

0 comments on commit bb4f87f

Please sign in to comment.