Add String::replace_char(s) methods for performance and convenience

This commit is contained in:
A Thousand Ships
2024-05-28 12:15:00 +02:00
parent c374ce211c
commit 889410dcda
67 changed files with 297 additions and 137 deletions

View File

@@ -42,9 +42,9 @@ String ProjectZIPPacker::get_project_zip_safe_name() {
// In the project name, all invalid characters become an empty string so that a name
// like "Platformer 2: Godette's Revenge" becomes "platformer_2-_godette-s_revenge".
const String project_name = GLOBAL_GET("application/config/name");
const String project_name_safe = project_name.to_lower().replace(" ", "_");
const String project_name_safe = project_name.to_lower().replace_char(' ', '_');
const String datetime_safe =
Time::get_singleton()->get_datetime_string_from_system(false, true).replace(" ", "_");
Time::get_singleton()->get_datetime_string_from_system(false, true).replace_char(' ', '_');
const String output_name = OS::get_singleton()->get_safe_dir_name(vformat("%s_%s.zip", project_name_safe, datetime_safe));
return output_name;
}