From 78e2e48d573b37a789776d8c613638c436d265e2 Mon Sep 17 00:00:00 2001 From: Felix Yang Date: Tue, 1 May 2018 21:07:41 +0200 Subject: [PATCH] Fix for Issue#18457 - Folder name with trailing space on Windows (cherry picked from commit 164dceab283e638ebcd4912d3b3df33d5c630883) --- editor/filesystem_dock.cpp | 2 +- editor/project_manager.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 97c76c84238..a5af706316b 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -917,7 +917,7 @@ void FileSystemDock::_make_dir_confirm() { if (dir_name.length() == 0) { EditorNode::get_singleton()->show_warning(TTR("No name provided")); return; - } else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.ends_with(".")) { + } else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) { EditorNode::get_singleton()->show_warning(TTR("Provided name contains invalid characters")); return; } diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index b2faa5694d6..b0f90aeb56f 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -250,8 +250,10 @@ private: void _create_folder() { - if (project_name->get_text() == "" || created_folder_path != "") + if (project_name->get_text() == "" || created_folder_path != "" || project_name->get_text().ends_with(".") || project_name->get_text().ends_with(" ")) { + set_message(TTR("Invalid Project Name."), MESSAGE_WARNING); return; + } DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (d->change_dir(project_path->get_text()) == OK) {