Merge pull request #82103 from bruvzg/icu_export

[Export] Fix TextServer data export.
This commit is contained in:
Rémi Verschelde 2023-10-03 17:21:41 +02:00
commit 1376a5a0ce
No known key found for this signature in database
GPG Key ID: C3336907360768E1
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.
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);
// Remove the file later.
MessageQueue::get_singleton()->push_callable(callable_mp_static(DirAccess::remove_absolute), icu_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 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), abs_path);
}
}
}
}
}