diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_dir_dialog.cpp | 11 | ||||
-rw-r--r-- | editor/editor_file_dialog.cpp | 8 | ||||
-rw-r--r-- | editor/editor_help_search.cpp | 6 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 14 |
4 files changed, 24 insertions, 15 deletions
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp index 866f28c03b..9fabde93ef 100644 --- a/editor/editor_dir_dialog.cpp +++ b/editor/editor_dir_dialog.cpp @@ -156,15 +156,18 @@ void EditorDirDialog::_make_dir_confirm() { String dir = ti->get_metadata(0); - if (EditorFileSystem::get_singleton()->get_filesystem_path(dir + makedirname->get_text())) { + DirAccessRef d = DirAccess::open(dir); + ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + dir + "'."); + + 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; } - DirAccessRef d = DirAccess::open(dir); - ERR_FAIL_COND_MSG(!d, "Cannot open directory '" + dir + "'."); - Error err = d->make_dir(makedirname->get_text()); + Error err = d->make_dir(stripped_dirname); if (err != OK) { mkdirerr->popup_centered(Size2(250, 80) * EDSCALE); } else { diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 179894915b..d5105b5ac8 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -1099,16 +1099,18 @@ EditorFileDialog::Access EditorFileDialog::get_access() const { } void EditorFileDialog::_make_dir_confirm() { - if (EditorFileSystem::get_singleton()->get_filesystem_path(makedirname->get_text().strip_edges())) { + const String stripped_dirname = makedirname->get_text().strip_edges(); + + if (dir_access->dir_exists(stripped_dirname)) { 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()); + Error err = dir_access->make_dir(stripped_dirname); if (err == OK) { - dir_access->change_dir(makedirname->get_text().strip_edges()); + dir_access->change_dir(stripped_dirname); invalidate(); update_filters(); update_dir(); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 8e03c55712..c747ae326f 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -331,7 +331,10 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { // Match class name. if (search_flags & SEARCH_CLASSES) { - match.name = term.is_empty() || _match_string(term, class_doc.name); + // If the search term is empty, add any classes which are not script docs or which don't start with + // a double-quotation. This will ensure that only C++ classes and explictly named classes will + // be added. + match.name = (term.is_empty() && (!class_doc.is_script_doc || class_doc.name[0] != '\"')) || _match_string(term, class_doc.name); } // Match members if the term is long enough. @@ -398,6 +401,7 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { } } } + matches[class_doc.name] = match; } iterator_doc = iterator_doc->next(); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index ee7ed77957..f6d00470d1 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1427,18 +1427,18 @@ void FileSystemDock::_make_dir_confirm() { directory = directory.get_base_dir(); } - if (EditorFileSystem::get_singleton()->get_filesystem_path(directory + dir_name)) { - EditorNode::get_singleton()->show_warning(TTR("Could not create folder. File with that name already exists.")); - return; - } - print_verbose("Making folder " + dir_name + " in " + directory); DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); Error err = da->change_dir(directory); - if (err == OK) { - err = da->make_dir(dir_name); + ERR_FAIL_COND_MSG(err != OK, "Cannot open directory '" + directory + "'."); + + if (da->dir_exists(directory)) { + EditorNode::get_singleton()->show_warning(TTR("Could not create folder. File with that name already exists.")); + return; } + err = da->make_dir(dir_name); + if (err == OK) { print_verbose("FileSystem: calling rescan."); _rescan(); |