From e0ca8be392234cf604d23d42876e2c987602ed4b Mon Sep 17 00:00:00 2001 From: kobewi Date: Tue, 24 Dec 2024 13:58:50 +0100 Subject: [PATCH] Re-create missing .uid files --- editor/editor_file_system.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index e6047064f1c..7a8f42c7da8 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1260,11 +1260,15 @@ void EditorFileSystem::_process_file_system(const ScannedDirectory *p_scan_dir, } } - if (fi->uid == ResourceUID::INVALID_ID && ResourceLoader::exists(path) && !ResourceLoader::has_custom_uid_support(path) && !FileAccess::exists(path + ".uid")) { - // Create a UID. + if (ResourceLoader::exists(path) && !ResourceLoader::has_custom_uid_support(path) && !FileAccess::exists(path + ".uid")) { + // Create a UID file and new UID, if it's invalid. Ref f = FileAccess::open(path + ".uid", FileAccess::WRITE); if (f.is_valid()) { - fi->uid = ResourceUID::get_singleton()->create_id(); + if (fi->uid == ResourceUID::INVALID_ID) { + fi->uid = ResourceUID::get_singleton()->create_id(); + } else { + WARN_PRINT(vformat("Missing .uid file for path \"%s\". The file was re-created from cache.", path)); + } f->store_line(ResourceUID::get_singleton()->id_to_text(fi->uid)); } }