@@ -900,19 +900,49 @@ String EditorExportPlatform::_get_script_encryption_key(const Ref<EditorExportPr
900
900
return p_preset->get_script_encryption_key ().to_lower ();
901
901
}
902
902
903
- Dictionary EditorExportPlatform::get_internal_export_files () {
903
+ Dictionary EditorExportPlatform::get_internal_export_files (const Ref<EditorExportPreset> &p_preset, bool p_debug ) {
904
904
Dictionary files;
905
905
906
906
// Text server support data.
907
907
if (TS->has_feature (TextServer::FEATURE_USE_SUPPORT_DATA) && (bool )GLOBAL_GET (" internationalization/locale/include_text_server_data" )) {
908
908
String ts_name = TS->get_support_data_filename ();
909
+ String ts_target = " res://" + ts_name;
909
910
if (!ts_name.is_empty ()) {
910
- ts_name = " res:// " + ts_name ;
911
- if (! FileAccess::exists (ts_name )) { // Do not include if user supplied data file exist .
912
- const PackedByteArray &ts_data = TS-> get_support_data ( );
911
+ bool export_ok = false ;
912
+ if (FileAccess::exists (ts_target )) { // Include user supplied data file.
913
+ const PackedByteArray &ts_data = FileAccess::get_file_as_bytes (ts_target );
913
914
if (!ts_data.is_empty ()) {
914
- files[ts_name] = ts_data;
915
+ add_message (EXPORT_MESSAGE_INFO, TTR (" Export" ), TTR (" Using user provided text server data, text display in the exported project might be broken if export template was built with different ICU version!" ));
916
+ files[ts_target] = ts_data;
917
+ export_ok = true ;
915
918
}
919
+ } else {
920
+ String current_version = VERSION_FULL_CONFIG;
921
+ String template_path = EditorPaths::get_singleton ()->get_export_templates_dir ().path_join (current_version);
922
+ if (p_debug && p_preset->has (" custom_template/debug" ) && p_preset->get (" custom_template/debug" ) != " " ) {
923
+ template_path = p_preset->get (" custom_template/debug" ).operator String ().get_base_dir ();
924
+ } else if (!p_debug && p_preset->has (" custom_template/release" ) && p_preset->get (" custom_template/release" ) != " " ) {
925
+ template_path = p_preset->get (" custom_template/release" ).operator String ().get_base_dir ();
926
+ }
927
+ String data_file_name = template_path.path_join (ts_name);
928
+ if (FileAccess::exists (data_file_name)) {
929
+ const PackedByteArray &ts_data = FileAccess::get_file_as_bytes (data_file_name);
930
+ if (!ts_data.is_empty ()) {
931
+ print_line (" Using text server data from export templates." );
932
+ files[ts_target] = ts_data;
933
+ export_ok = true ;
934
+ }
935
+ } else {
936
+ const PackedByteArray &ts_data = TS->get_support_data ();
937
+ if (!ts_data.is_empty ()) {
938
+ add_message (EXPORT_MESSAGE_INFO, TTR (" Export" ), TTR (" Using editor embedded text server data, text display in the exported project might be broken if export template was built with different ICU version!" ));
939
+ files[ts_target] = ts_data;
940
+ export_ok = true ;
941
+ }
942
+ }
943
+ }
944
+ if (!export_ok) {
945
+ add_message (EXPORT_MESSAGE_WARNING, TTR (" Export" ), TTR (" Missing text server data, text display in the exported project might be broken!" ));
916
946
}
917
947
}
918
948
}
@@ -943,17 +973,6 @@ Vector<String> EditorExportPlatform::get_forced_export_files() {
943
973
files.push_back (extension_list_config_file);
944
974
}
945
975
946
- // Text server support data.
947
- if (TS->has_feature (TextServer::FEATURE_USE_SUPPORT_DATA) && (bool )GLOBAL_GET (" internationalization/locale/include_text_server_data" )) {
948
- String ts_name = TS->get_support_data_filename ();
949
- if (!ts_name.is_empty ()) {
950
- ts_name = " res://" + ts_name;
951
- if (FileAccess::exists (ts_name)) { // Include user supplied data file.
952
- files.push_back (ts_name);
953
- }
954
- }
955
- }
956
-
957
976
return files;
958
977
}
959
978
@@ -1518,7 +1537,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
1518
1537
}
1519
1538
}
1520
1539
1521
- Dictionary int_export = get_internal_export_files ();
1540
+ Dictionary int_export = get_internal_export_files (p_preset, p_debug );
1522
1541
for (const Variant &int_name : int_export.keys ()) {
1523
1542
const PackedByteArray &array = int_export[int_name];
1524
1543
err = p_save_func (p_udata, int_name, array, idx, total, enc_in_filters, enc_ex_filters, key, seed);
@@ -2443,8 +2462,9 @@ void EditorExportPlatform::_bind_methods() {
2443
2462
ClassDB::bind_method (D_METHOD (" ssh_run_on_remote_no_wait" , " host" , " port" , " ssh_args" , " cmd_args" , " port_fwd" ), &EditorExportPlatform::_ssh_run_on_remote_no_wait, DEFVAL (-1 ));
2444
2463
ClassDB::bind_method (D_METHOD (" ssh_push_to_remote" , " host" , " port" , " scp_args" , " src_file" , " dst_file" ), &EditorExportPlatform::ssh_push_to_remote);
2445
2464
2465
+ ClassDB::bind_method (D_METHOD (" get_internal_export_files" , " preset" , " debug" ), &EditorExportPlatform::get_internal_export_files);
2466
+
2446
2467
ClassDB::bind_static_method (" EditorExportPlatform" , D_METHOD (" get_forced_export_files" ), &EditorExportPlatform::get_forced_export_files);
2447
- ClassDB::bind_static_method (" EditorExportPlatform" , D_METHOD (" get_internal_export_files" ), &EditorExportPlatform::get_internal_export_files);
2448
2468
2449
2469
BIND_ENUM_CONSTANT (EXPORT_MESSAGE_NONE);
2450
2470
BIND_ENUM_CONSTANT (EXPORT_MESSAGE_INFO);
0 commit comments