mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-21 18:23:54 -04:00
Merge 79a2e6f977cf651c0f4bff4652d26265c470f9b4 into bd9ae189f83e33a6977bbe056774c851e96fe0a7
This commit is contained in:
commit
bceafd56b0
@ -48,6 +48,7 @@ import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||
import static org.jackhuang.hmcl.util.logging.Logger.LOG;
|
||||
|
||||
public final class ProfilePage extends BorderPane implements DecoratorPage {
|
||||
private final ReadOnlyObjectWrapper<State> state = new ReadOnlyObjectWrapper<>();
|
||||
@ -114,6 +115,24 @@ public final class ProfilePage extends BorderPane implements DecoratorPage {
|
||||
gameDir.setTitle(i18n("profile.instance_directory.choose"));
|
||||
gameDir.pathProperty().bindBidirectional(location);
|
||||
|
||||
locationProperty().addListener((observable, oldValue, newValue) -> {
|
||||
LOG.debug("OnChange locationProperty");
|
||||
|
||||
var folder = new File(newValue);
|
||||
var oldFolder = new File(oldValue);
|
||||
File parentFolder = folder.getParentFile();
|
||||
File parentOldFolder = oldFolder.getParentFile();
|
||||
// txtProfileName
|
||||
if (parentFolder != null) {
|
||||
if (txtProfileName.getText().isEmpty()) {
|
||||
txtProfileName.setText(parentFolder.getName());
|
||||
}
|
||||
else if (!parentFolder.getName().equals(parentOldFolder.getName())) {
|
||||
txtProfileName.setText(parentFolder.getName());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
toggleUseRelativePath = new OptionToggleButton();
|
||||
toggleUseRelativePath.setTitle(i18n("profile.use_relative_path"));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user