mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 02:51:25 +00:00
Add better alert dialogs if directory already exists
Signed-off-by: Daniel Kříž <Daniel.kriz@protonmail.com>
This commit is contained in:
parent
391633760b
commit
2a6cb29a0f
3 changed files with 19 additions and 1 deletions
|
|
@ -156,10 +156,15 @@ void EditorDirDialog::_make_dir_confirm() {
|
|||
|
||||
String dir = ti->get_metadata(0);
|
||||
|
||||
if (EditorFileSystem::get_singleton()->get_filesystem_path(dir + makedirname->get_text())) {
|
||||
mkdirerr->set_text(TTR("Could not create folder. File with that name already exists."));
|
||||
mkdirerr->popup_centered();
|
||||
return;
|
||||
}
|
||||
|
||||
DirAccessRef d = DirAccess::open(dir);
|
||||
ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + dir + "'.");
|
||||
Error err = d->make_dir(makedirname->get_text());
|
||||
|
||||
if (err != OK) {
|
||||
mkdirerr->popup_centered(Size2(250, 80) * EDSCALE);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue