From 5583ac521818579b8d2ebdd95b64e46948c43684 Mon Sep 17 00:00:00 2001 From: Grublady Date: Sat, 6 Jul 2024 18:49:33 -0400 Subject: [PATCH] =?UTF-8?q?Ignore=20trailing=20slashes=20in=20new=20projec?= =?UTF-8?q?t=E2=80=99s=20path=20when=20disabling=20Create=20Folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the “Create New Project” dialog, disabling the “Create Folder” slider with a trailing slash in the project path would cause it to incorrectly identify the last path component as the substring following the slash, in other words, an empty string. By first discarding any trailing slashes when disabling the slider, the project dialog will now identify and pop the last path component as usual even when a trailing slash is present. --- editor/project_manager/project_dialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp index 262a1ecc1a48..be5fa8745c0e 100644 --- a/editor/project_manager/project_dialog.cpp +++ b/editor/project_manager/project_dialog.cpp @@ -315,6 +315,8 @@ void ProjectDialog::_create_dir_toggled(bool p_pressed) { target_path = target_path.path_join(last_custom_target_dir); } } else { + // Strip any trailing slash. + target_path = target_path.rstrip("/\\"); // Save and remove target dir name. if (target_path.get_file() == auto_dir) { last_custom_target_dir = "";