|
@@ -142,14 +142,22 @@ Error ResourceImporterCSVTranslation::import(ResourceUID::ID p_source_id, const
|
|
}
|
|
}
|
|
|
|
|
|
String save_path = p_source_file.get_basename() + "." + translations[i]->get_locale() + ".translation";
|
|
String save_path = p_source_file.get_basename() + "." + translations[i]->get_locale() + ".translation";
|
|
|
|
+ ResourceUID::ID save_id = hash64_murmur3_64(translations[i]->get_locale().hash64(), p_source_id) & 0x7FFFFFFFFFFFFFFF;
|
|
|
|
+ bool uid_already_exists = ResourceUID::get_singleton()->has_id(save_id);
|
|
|
|
+ if (uid_already_exists) {
|
|
|
|
+ // Avoid creating a new file with a duplicate UID.
|
|
|
|
+ // Always use this UID, even if the user has moved it to a different path.
|
|
|
|
+ save_path = ResourceUID::get_singleton()->get_id_path(save_id);
|
|
|
|
+ }
|
|
|
|
|
|
ResourceSaver::save(xlt, save_path);
|
|
ResourceSaver::save(xlt, save_path);
|
|
if (r_gen_files) {
|
|
if (r_gen_files) {
|
|
r_gen_files->push_back(save_path);
|
|
r_gen_files->push_back(save_path);
|
|
}
|
|
}
|
|
-
|
|
|
|
- ResourceUID::ID save_id = hash64_murmur3_64(translations[i]->get_locale().hash64(), p_source_id);
|
|
|
|
- ResourceSaver::set_uid(save_path, save_id);
|
|
|
|
|
|
+ if (!uid_already_exists) {
|
|
|
|
+ // No need to call set_uid if save_path already refers to save_id.
|
|
|
|
+ ResourceSaver::set_uid(save_path, save_id);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
return OK;
|
|
return OK;
|