1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Add better alert dialogs if directory already exists

Signed-off-by: Daniel Kříž <Daniel.kriz@protonmail.com>
This commit is contained in:
Daniel Kříž
2022-03-24 23:27:33 +01:00
parent 391633760b
commit 2a6cb29a0f
3 changed files with 19 additions and 1 deletions

View File

@@ -1092,6 +1092,13 @@ EditorFileDialog::Access EditorFileDialog::get_access() const {
}
void EditorFileDialog::_make_dir_confirm() {
if (EditorFileSystem::get_singleton()->get_filesystem_path(makedirname->get_text().strip_edges())) {
error_dialog->set_text(TTR("Could not create folder. File with that name already exists."));
error_dialog->popup_centered(Size2(250, 50) * EDSCALE);
makedirname->set_text(""); // Reset label.
return;
}
Error err = dir_access->make_dir(makedirname->get_text().strip_edges());
if (err == OK) {
dir_access->change_dir(makedirname->get_text().strip_edges());