Enhanced error message on folder creation with invalid chars on Windows

If the user tried to create folder with *, | or > in its name it would
return a generic error "Could not create folder."
Now the same message is shown when creating a folder with /, \\, :, *,
|, > or ending with . or an empty space.
This commit is contained in:
Silvano Cerza 2018-10-18 21:15:08 +02:00
parent 00125ef8df
commit 0759760856

View File

@ -1217,7 +1217,8 @@ 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(".") || dir_name.ends_with(" ")) {
} else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || 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;
}