Skip to content

Commit 9cf13c7

Browse files
committed
fix: 修复 ProfilePage 编辑实例时名称和路径自动修改的问题 (#6000)
- 编辑时使用 profile.getName() 而非 getProfileDisplayName(),避免保留名称被翻译后保存 - locationChangeListener 只在新建设置时注册,编辑时禁用,避免路径变化自动重命名实例
1 parent 856bc3e commit 9cf13c7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/ui/profile/ProfilePage.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public ProfilePage(Profile profile) {
9292
txtProfileName.getValidators().add(validator);
9393
BorderPane.setMargin(txtProfileName, new Insets(8, 0, 8, 0));
9494

95-
txtProfileName.setText(profileDisplayName);
95+
txtProfileName.setText(profile == null ? "" : profile.getName());
9696
txtProfileName.getValidators().add(new ValidatorBase() {
9797
{
9898
setMessage(i18n("profile.already_exists"));
@@ -168,7 +168,9 @@ protected void eval() {
168168
txtProfileName.setText(suggestedName);
169169
}
170170
};
171-
locationProperty().addListener(locationChangeListener);
171+
if (profile == null) {
172+
locationProperty().addListener(locationChangeListener);
173+
}
172174

173175
txtProfileNameChangeListener = new ChangeListener<>() {
174176
@Override

0 commit comments

Comments
 (0)