[Export] Fix TextServer data export.

This commit is contained in:
bruvzg 2023-09-22 11:50:35 +03:00
parent fe5b1c8d49
commit 59d5b2d6d3
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
1 changed files with 14 additions and 10 deletions

View File

@ -859,16 +859,20 @@ Vector<String> EditorExportPlatform::get_forced_export_files() {
bool use_data = GLOBAL_GET("internationalization/locale/include_text_server_data");
if (use_data) {
// Try using user provided data file.
if (!TS->get_support_data_filename().is_empty()) {
String ts_data = "res://" + TS->get_support_data_filename();
if (FileAccess::exists(ts_data)) {
files.push_back(ts_data);
} else {
// Use default text server data.
String icu_data_file = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp_icu_data");
ERR_FAIL_COND_V(!TS->save_support_data(icu_data_file), files);
files.push_back(icu_data_file);
String abs_path = ProjectSettings::get_singleton()->globalize_path(ts_data);
ERR_FAIL_COND_V(!TS->save_support_data(abs_path), files);
if (FileAccess::exists(abs_path)) {
files.push_back(ts_data);
// Remove the file later.
MessageQueue::get_singleton()->push_callable(callable_mp_static(DirAccess::remove_absolute), icu_data_file);
MessageQueue::get_singleton()->push_callable(callable_mp_static(DirAccess::remove_absolute), abs_path);
}
}
}
}
}