Prevent creating any type of file with a leading dot

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: gotnospirit <gotnospirit@gmail.com>
This commit is contained in:
sekoia 2023-08-28 15:27:00 +02:00
parent 031f6deefb
commit bbeb2f98f5
4 changed files with 19 additions and 4 deletions

View file

@ -243,6 +243,9 @@ String ScriptCreateDialog::_validate_path(const String &p_path, bool p_file_must
if (!p.get_file().get_basename().is_valid_filename()) {
return TTR("Filename is invalid.");
}
if (p.get_file().begins_with(".")) {
return TTR("Name begins with a dot.");
}
p = ProjectSettings::get_singleton()->localize_path(p);
if (!p.begins_with("res://")) {