@@ -214,36 +214,36 @@ String ProjectSettings::localize_path(const String &p_path) const {
214214}
215215
216216void ProjectSettings::set_initial_value (const String &p_name, const Variant &p_value) {
217- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
217+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
218218
219219 // Duplicate so that if value is array or dictionary, changing the setting will not change the stored initial value.
220220 props[p_name].initial = p_value.duplicate ();
221221}
222222
223223void ProjectSettings::set_restart_if_changed (const String &p_name, bool p_restart) {
224- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
224+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
225225 props[p_name].restart_if_changed = p_restart;
226226}
227227
228228void ProjectSettings::set_as_basic (const String &p_name, bool p_basic) {
229- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
229+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
230230 props[p_name].basic = p_basic;
231231}
232232
233233void ProjectSettings::set_as_internal (const String &p_name, bool p_internal) {
234- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
234+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
235235 props[p_name].internal = p_internal;
236236}
237237
238238void ProjectSettings::set_ignore_value_in_docs (const String &p_name, bool p_ignore) {
239- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
239+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
240240#ifdef DEBUG_METHODS_ENABLED
241241 props[p_name].ignore_value_in_docs = p_ignore;
242242#endif
243243}
244244
245245bool ProjectSettings::get_ignore_value_in_docs (const String &p_name) const {
246- ERR_FAIL_COND_V_MSG (!props.has (p_name), false , " Request for nonexistent project setting: " + p_name + " . " );
246+ ERR_FAIL_COND_V_MSG (!props.has (p_name), false , vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
247247#ifdef DEBUG_METHODS_ENABLED
248248 return props[p_name].ignore_value_in_docs ;
249249#else
@@ -371,7 +371,7 @@ Variant ProjectSettings::get_setting_with_override(const StringName &p_name) con
371371 }
372372
373373 if (!props.has (name)) {
374- WARN_PRINT (" Property not found: " + String (name));
374+ WARN_PRINT (vformat ( " Property not found: '%s'. " , String (name) ));
375375 return Variant ();
376376 }
377377 return props[name].variant ;
@@ -565,7 +565,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
565565
566566 if (!p_main_pack.is_empty ()) {
567567 bool ok = _load_resource_pack (p_main_pack);
568- ERR_FAIL_COND_V_MSG (!ok, ERR_CANT_OPEN, " Cannot open resource pack '" + p_main_pack + " '." );
568+ ERR_FAIL_COND_V_MSG (!ok, ERR_CANT_OPEN, vformat ( " Cannot open resource pack '%s '." , p_main_pack) );
569569
570570 Error err = _load_settings_text_or_binary (" res://project.godot" , " res://project.binary" );
571571 if (err == OK && !p_ignore_override) {
@@ -644,7 +644,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
644644 // or, if requested (`p_upwards`) in parent directories.
645645
646646 Ref<DirAccess> d = DirAccess::create (DirAccess::ACCESS_FILESYSTEM);
647- ERR_FAIL_COND_V_MSG (d.is_null (), ERR_CANT_CREATE, " Cannot create DirAccess for path '" + p_path + " '." );
647+ ERR_FAIL_COND_V_MSG (d.is_null (), ERR_CANT_CREATE, vformat ( " Cannot create DirAccess for path '%s '." , p_path) );
648648 d->change_dir (p_path);
649649
650650 String current_dir = d->get_current_dir ();
@@ -748,7 +748,7 @@ Error ProjectSettings::_load_settings_binary(const String &p_path) {
748748 f->get_buffer (d.ptrw (), vlen);
749749 Variant value;
750750 err = decode_variant (value, d.ptr (), d.size (), nullptr , true );
751- ERR_CONTINUE_MSG (err != OK, " Error decoding property: " + key + " . " );
751+ ERR_CONTINUE_MSG (err != OK, vformat ( " Error decoding property: '%s'. " , key) );
752752 set (key, value);
753753 }
754754
@@ -790,7 +790,7 @@ Error ProjectSettings::_load_settings_text(const String &p_path) {
790790 last_save_time = FileAccess::get_modified_time (get_resource_path ().path_join (" project.godot" ));
791791 return OK;
792792 }
793- ERR_FAIL_COND_V_MSG (err != OK, err, " Error parsing " + p_path + " at line " + itos (lines) + " : " + error_text + " File might be corrupted." );
793+ ERR_FAIL_COND_V_MSG (err != OK, err, vformat ( " Error parsing '%s' at line %d: %s File might be corrupted." , p_path, lines, error_text) );
794794
795795 if (!assign.is_empty ()) {
796796 if (section.is_empty () && assign == " config_version" ) {
@@ -816,15 +816,15 @@ Error ProjectSettings::_load_settings_text_or_binary(const String &p_text_path,
816816 return OK;
817817 } else if (err != ERR_FILE_NOT_FOUND) {
818818 // If the file exists but can't be loaded, we want to know it.
819- ERR_PRINT (" Couldn't load file '" + p_bin_path + " ', error code " + itos ( err) + " . " );
819+ ERR_PRINT (vformat ( " Couldn't load file '%s ', error code %d. " , p_bin_path, err));
820820 }
821821
822822 // Fallback to text-based project.godot file if binary was not found.
823823 err = _load_settings_text (p_text_path);
824824 if (err == OK) {
825825 return OK;
826826 } else if (err != ERR_FILE_NOT_FOUND) {
827- ERR_PRINT (" Couldn't load file '" + p_text_path + " ', error code " + itos ( err) + " . " );
827+ ERR_PRINT (vformat ( " Couldn't load file '%s ', error code %d. " , p_text_path, err));
828828 }
829829
830830 return err;
@@ -838,30 +838,30 @@ Error ProjectSettings::load_custom(const String &p_path) {
838838}
839839
840840int ProjectSettings::get_order (const String &p_name) const {
841- ERR_FAIL_COND_V_MSG (!props.has (p_name), -1 , " Request for nonexistent project setting: " + p_name + " . " );
841+ ERR_FAIL_COND_V_MSG (!props.has (p_name), -1 , vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
842842 return props[p_name].order ;
843843}
844844
845845void ProjectSettings::set_order (const String &p_name, int p_order) {
846- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
846+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
847847 props[p_name].order = p_order;
848848}
849849
850850void ProjectSettings::set_builtin_order (const String &p_name) {
851- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
851+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
852852 if (props[p_name].order >= NO_BUILTIN_ORDER_BASE) {
853853 props[p_name].order = last_builtin_order++;
854854 }
855855}
856856
857857bool ProjectSettings::is_builtin_setting (const String &p_name) const {
858858 // Return true because a false negative is worse than a false positive.
859- ERR_FAIL_COND_V_MSG (!props.has (p_name), true , " Request for nonexistent project setting: " + p_name + " . " );
859+ ERR_FAIL_COND_V_MSG (!props.has (p_name), true , vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
860860 return props[p_name].order < NO_BUILTIN_ORDER_BASE;
861861}
862862
863863void ProjectSettings::clear (const String &p_name) {
864- ERR_FAIL_COND_MSG (!props.has (p_name), " Request for nonexistent project setting: " + p_name + " . " );
864+ ERR_FAIL_COND_MSG (!props.has (p_name), vformat ( " Request for nonexistent project setting: '%s'. " , p_name) );
865865 props.erase (p_name);
866866}
867867
@@ -876,7 +876,7 @@ Error ProjectSettings::save() {
876876Error ProjectSettings::_save_settings_binary (const String &p_file, const RBMap<String, List<String>> &p_props, const CustomMap &p_custom, const String &p_custom_features) {
877877 Error err;
878878 Ref<FileAccess> file = FileAccess::open (p_file, FileAccess::WRITE, &err);
879- ERR_FAIL_COND_V_MSG (err != OK, err, " Couldn't save project.binary at " + p_file + " . " );
879+ ERR_FAIL_COND_V_MSG (err != OK, err, vformat ( " Couldn't save project.binary at '%s'. " , p_file) );
880880
881881 uint8_t hdr[4 ] = { ' E' , ' C' , ' F' , ' G' };
882882 file->store_buffer (hdr, 4 );
@@ -946,7 +946,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const RBMap<Str
946946 Error err;
947947 Ref<FileAccess> file = FileAccess::open (p_file, FileAccess::WRITE, &err);
948948
949- ERR_FAIL_COND_V_MSG (err != OK, err, " Couldn't save project.godot - " + p_file + " . " );
949+ ERR_FAIL_COND_V_MSG (err != OK, err, vformat ( " Couldn't save project.godot - %s. " , p_file) );
950950
951951 file->store_line (" ; Engine configuration file." );
952952 file->store_line (" ; It's best edited using the editor UI and not directly," );
@@ -1119,7 +1119,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
11191119 } else if (p_path.ends_with (" .binary" )) {
11201120 return _save_settings_binary (p_path, save_props, p_custom, save_features);
11211121 } else {
1122- ERR_FAIL_V_MSG (ERR_FILE_UNRECOGNIZED, " Unknown config file format: " + p_path);
1122+ ERR_FAIL_V_MSG (ERR_FILE_UNRECOGNIZED, vformat ( " Unknown config file format: '%s'. " , p_path) );
11231123 }
11241124}
11251125
0 commit comments