From cd269b825f35fca5e2e1bba6bfcb44742b57343e Mon Sep 17 00:00:00 2001 From: Alex Darby Date: Tue, 5 Dec 2023 14:11:09 +0000 Subject: [PATCH] Make File Dialog case insensitive Change FileDialog and EditorFileDialog to use case insensitive string comparisons when saving files to avoid duplicate file extensions. --- editor/gui/editor_file_dialog.cpp | 6 +++--- scene/gui/file_dialog.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index 77d0ba7a60a..f603e26bbc9 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -127,7 +127,7 @@ void EditorFileDialog::_native_dialog_cb(bool p_ok, const Vector &p_file int filter_slice_count = flt.get_slice_count(","); for (int j = 0; j < filter_slice_count; j++) { String str = (flt.get_slice(",", j).strip_edges()); - if (f.match(str)) { + if (f.matchn(str)) { valid = true; break; } @@ -565,7 +565,7 @@ void EditorFileDialog::_action_pressed() { String flt = filters[i].get_slice(";", 0); for (int j = 0; j < flt.get_slice_count(","); j++) { String str = flt.get_slice(",", j).strip_edges(); - if (f.match(str)) { + if (f.matchn(str)) { valid = true; break; } @@ -584,7 +584,7 @@ void EditorFileDialog::_action_pressed() { int filterSliceCount = flt.get_slice_count(","); for (int j = 0; j < filterSliceCount; j++) { String str = (flt.get_slice(",", j).strip_edges()); - if (f.match(str)) { + if (f.matchn(str)) { valid = true; break; } diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index d8e9d1bcc00..b35b1c5dca5 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -138,7 +138,7 @@ void FileDialog::_native_dialog_cb(bool p_ok, const Vector &p_files, int int filter_slice_count = flt.get_slice_count(","); for (int j = 0; j < filter_slice_count; j++) { String str = (flt.get_slice(",", j).strip_edges()); - if (f.match(str)) { + if (f.matchn(str)) { valid = true; break; } @@ -473,7 +473,7 @@ void FileDialog::_action_pressed() { String flt = filters[i].get_slice(";", 0); for (int j = 0; j < flt.get_slice_count(","); j++) { String str = flt.get_slice(",", j).strip_edges(); - if (f.match(str)) { + if (f.matchn(str)) { valid = true; break; } @@ -492,7 +492,7 @@ void FileDialog::_action_pressed() { int filterSliceCount = flt.get_slice_count(","); for (int j = 0; j < filterSliceCount; j++) { String str = (flt.get_slice(",", j).strip_edges()); - if (f.match(str)) { + if (f.matchn(str)) { valid = true; break; }