summaryrefslogtreecommitdiff
path: root/editor/editor_dir_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_dir_dialog.cpp')
-rw-r--r--editor/editor_dir_dialog.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 32ef87a4ab..9fabde93ef 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -158,8 +158,16 @@ void EditorDirDialog::_make_dir_confirm() {
DirAccessRef d = DirAccess::open(dir);
ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + dir + "'.");
- Error err = d->make_dir(makedirname->get_text());
+ const String stripped_dirname = makedirname->get_text().strip_edges();
+
+ if (d->dir_exists(stripped_dirname)) {
+ mkdirerr->set_text(TTR("Could not create folder. File with that name already exists."));
+ mkdirerr->popup_centered();
+ return;
+ }
+
+ Error err = d->make_dir(stripped_dirname);
if (err != OK) {
mkdirerr->popup_centered(Size2(250, 80) * EDSCALE);
} else {