summaryrefslogtreecommitdiff
path: root/editor/editor_file_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_file_dialog.cpp')
-rw-r--r--editor/editor_file_dialog.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 31f2f24066..ca3e70830c 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -106,7 +106,7 @@ void EditorFileDialog::_notification(int p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
- set_process_unhandled_input(false);
+ set_process_shortcut_input(false);
}
} break;
@@ -126,7 +126,7 @@ void EditorFileDialog::_notification(int p_what) {
}
}
-void EditorFileDialog::unhandled_input(const Ref<InputEvent> &p_event) {
+void EditorFileDialog::shortcut_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
Ref<InputEventKey> k = p_event;
@@ -327,7 +327,7 @@ void EditorFileDialog::_post_popup() {
_update_favorites();
}
- set_process_unhandled_input(true);
+ set_process_shortcut_input(true);
}
void EditorFileDialog::_thumbnail_result(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) {
@@ -781,12 +781,19 @@ void EditorFileDialog::update_file_list() {
continue;
}
- if (show_hidden_files || !dir_access->current_is_hidden()) {
+ if (show_hidden_files) {
if (!dir_access->current_is_dir()) {
files.push_back(item);
} else {
dirs.push_back(item);
}
+ } else if (!dir_access->current_is_hidden()) {
+ String full_path = cdir == "res://" ? item : dir_access->get_current_dir() + "/" + item;
+ if (dir_access->current_is_dir() && (!EditorFileSystem::_should_skip_directory(full_path) || Engine::get_singleton()->is_project_manager_hint())) {
+ dirs.push_back(item);
+ } else {
+ files.push_back(item);
+ }
}
item = dir_access->get_next();
}
@@ -1092,9 +1099,18 @@ EditorFileDialog::Access EditorFileDialog::get_access() const {
}
void EditorFileDialog::_make_dir_confirm() {
- Error err = dir_access->make_dir(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(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();
@@ -1294,6 +1310,18 @@ void EditorFileDialog::_update_favorites() {
favorite->set_pressed(false);
Vector<String> favorited = EditorSettings::get_singleton()->get_favorites();
+
+ bool fav_changed = false;
+ for (int i = favorited.size() - 1; i >= 0; i--) {
+ if (!dir_access->dir_exists(favorited[i])) {
+ favorited.remove_at(i);
+ fav_changed = true;
+ }
+ }
+ if (fav_changed) {
+ EditorSettings::get_singleton()->set_favorites(favorited);
+ }
+
for (int i = 0; i < favorited.size(); i++) {
bool cres = favorited[i].begins_with("res://");
if (cres != res) {