|
@@ -900,19 +900,49 @@ String EditorExportPlatform::_get_script_encryption_key(const Ref<EditorExportPr
|
|
return p_preset->get_script_encryption_key().to_lower();
|
|
return p_preset->get_script_encryption_key().to_lower();
|
|
}
|
|
}
|
|
|
|
|
|
-Dictionary EditorExportPlatform::get_internal_export_files() {
|
|
|
|
|
|
+Dictionary EditorExportPlatform::get_internal_export_files(const Ref<EditorExportPreset> &p_preset, bool p_debug) {
|
|
Dictionary files;
|
|
Dictionary files;
|
|
|
|
|
|
// Text server support data.
|
|
// Text server support data.
|
|
if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)GLOBAL_GET("internationalization/locale/include_text_server_data")) {
|
|
if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)GLOBAL_GET("internationalization/locale/include_text_server_data")) {
|
|
String ts_name = TS->get_support_data_filename();
|
|
String ts_name = TS->get_support_data_filename();
|
|
|
|
+ String ts_target = "res://" + ts_name;
|
|
if (!ts_name.is_empty()) {
|
|
if (!ts_name.is_empty()) {
|
|
- ts_name = "res://" + ts_name;
|
|
|
|
- if (!FileAccess::exists(ts_name)) { // Do not include if user supplied data file exist.
|
|
|
|
- const PackedByteArray &ts_data = TS->get_support_data();
|
|
|
|
|
|
+ bool export_ok = false;
|
|
|
|
+ if (FileAccess::exists(ts_target)) { // Include user supplied data file.
|
|
|
|
+ const PackedByteArray &ts_data = FileAccess::get_file_as_bytes(ts_target);
|
|
if (!ts_data.is_empty()) {
|
|
if (!ts_data.is_empty()) {
|
|
- files[ts_name] = ts_data;
|
|
|
|
|
|
+ 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!"));
|
|
|
|
+ files[ts_target] = ts_data;
|
|
|
|
+ export_ok = true;
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ String current_version = VERSION_FULL_CONFIG;
|
|
|
|
+ String template_path = EditorPaths::get_singleton()->get_export_templates_dir().path_join(current_version);
|
|
|
|
+ if (p_debug && p_preset->has("custom_template/debug") && p_preset->get("custom_template/debug") != "") {
|
|
|
|
+ template_path = p_preset->get("custom_template/debug").operator String().get_base_dir();
|
|
|
|
+ } else if (!p_debug && p_preset->has("custom_template/release") && p_preset->get("custom_template/release") != "") {
|
|
|
|
+ template_path = p_preset->get("custom_template/release").operator String().get_base_dir();
|
|
|
|
+ }
|
|
|
|
+ String data_file_name = template_path.path_join(ts_name);
|
|
|
|
+ if (FileAccess::exists(data_file_name)) {
|
|
|
|
+ const PackedByteArray &ts_data = FileAccess::get_file_as_bytes(data_file_name);
|
|
|
|
+ if (!ts_data.is_empty()) {
|
|
|
|
+ print_line("Using text server data from export templates.");
|
|
|
|
+ files[ts_target] = ts_data;
|
|
|
|
+ export_ok = true;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ const PackedByteArray &ts_data = TS->get_support_data();
|
|
|
|
+ if (!ts_data.is_empty()) {
|
|
|
|
+ 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!"));
|
|
|
|
+ files[ts_target] = ts_data;
|
|
|
|
+ export_ok = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!export_ok) {
|
|
|
|
+ add_message(EXPORT_MESSAGE_WARNING, TTR("Export"), TTR("Missing text server data, text display in the exported project might be broken!"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -943,17 +973,6 @@ Vector<String> EditorExportPlatform::get_forced_export_files() {
|
|
files.push_back(extension_list_config_file);
|
|
files.push_back(extension_list_config_file);
|
|
}
|
|
}
|
|
|
|
|
|
- // Text server support data.
|
|
|
|
- if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)GLOBAL_GET("internationalization/locale/include_text_server_data")) {
|
|
|
|
- String ts_name = TS->get_support_data_filename();
|
|
|
|
- if (!ts_name.is_empty()) {
|
|
|
|
- ts_name = "res://" + ts_name;
|
|
|
|
- if (FileAccess::exists(ts_name)) { // Include user supplied data file.
|
|
|
|
- files.push_back(ts_name);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return files;
|
|
return files;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1518,7 +1537,7 @@ Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- Dictionary int_export = get_internal_export_files();
|
|
|
|
|
|
+ Dictionary int_export = get_internal_export_files(p_preset, p_debug);
|
|
for (const Variant &int_name : int_export.keys()) {
|
|
for (const Variant &int_name : int_export.keys()) {
|
|
const PackedByteArray &array = int_export[int_name];
|
|
const PackedByteArray &array = int_export[int_name];
|
|
err = p_save_func(p_udata, int_name, array, idx, total, enc_in_filters, enc_ex_filters, key, seed);
|
|
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() {
|
|
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));
|
|
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));
|
|
ClassDB::bind_method(D_METHOD("ssh_push_to_remote", "host", "port", "scp_args", "src_file", "dst_file"), &EditorExportPlatform::ssh_push_to_remote);
|
|
ClassDB::bind_method(D_METHOD("ssh_push_to_remote", "host", "port", "scp_args", "src_file", "dst_file"), &EditorExportPlatform::ssh_push_to_remote);
|
|
|
|
|
|
|
|
+ ClassDB::bind_method(D_METHOD("get_internal_export_files", "preset", "debug"), &EditorExportPlatform::get_internal_export_files);
|
|
|
|
+
|
|
ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files"), &EditorExportPlatform::get_forced_export_files);
|
|
ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files"), &EditorExportPlatform::get_forced_export_files);
|
|
- ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_internal_export_files"), &EditorExportPlatform::get_internal_export_files);
|
|
|
|
|
|
|
|
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_NONE);
|
|
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_NONE);
|
|
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_INFO);
|
|
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_INFO);
|