summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-17 00:35:00 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-17 00:35:00 +0100
commit2824774d2980417cb36ebcd5ef283d2475bf76a0 (patch)
treee4f2411c728745482bb977bea445a362b5ae11c0 /scene/gui
parentf1cda3a01667675650e985bbe6e482137c98cce4 (diff)
parent010ddfbc16e30723c7db44c71bc295b08e9febaf (diff)
Merge pull request #69801 from nongvantinh/fix-invalid-scene-name
Fixed scene name can be saved as extension only
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/file_dialog.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp
index 5dd8cde342..ee065cccbf 100644
--- a/scene/gui/file_dialog.cpp
+++ b/scene/gui/file_dialog.cpp
@@ -347,14 +347,15 @@ void FileDialog::_action_pressed() {
}
}
- if (!valid) {
+ String file_name = file_text.strip_edges().get_file();
+ if (!valid || file_name.is_empty()) {
exterr->popup_centered(Size2(250, 80));
return;
}
if (dir_access->file_exists(f)) {
- confirm_save->set_text(RTR("File exists, overwrite?"));
- confirm_save->popup_centered(Size2(200, 80));
+ confirm_save->set_text(vformat(RTR("File \"%s\" already exists.\nDo you want to overwrite it?"), f));
+ confirm_save->popup_centered(Size2(250, 80));
} else {
emit_signal(SNAME("file_selected"), f);
hide();
@@ -1136,7 +1137,7 @@ FileDialog::FileDialog() {
add_child(mkdirerr, false, INTERNAL_MODE_FRONT);
exterr = memnew(AcceptDialog);
- exterr->set_text(RTR("Must use a valid extension."));
+ exterr->set_text(RTR("Invalid extension, or empty filename."));
add_child(exterr, false, INTERNAL_MODE_FRONT);
update_filters();