1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Fix global class cache file not present when no class name

This commit is contained in:
Hilderin
2024-07-31 16:57:25 -04:00
parent b6dee96f68
commit 1ed723bd19
3 changed files with 9 additions and 5 deletions

View File

@@ -1353,12 +1353,17 @@ void EditorFileSystem::_thread_func_sources(void *_userdata) {
void EditorFileSystem::_remove_invalid_global_class_names(const HashSet<String> &p_existing_class_names) {
List<StringName> global_classes;
bool must_save = false;
ScriptServer::get_global_class_list(&global_classes);
for (const StringName &class_name : global_classes) {
if (!p_existing_class_names.has(class_name)) {
ScriptServer::remove_global_class(class_name);
must_save = true;
}
}
if (must_save) {
ScriptServer::save_global_classes();
}
}
String EditorFileSystem::_get_file_by_class_name(EditorFileSystemDirectory *p_dir, const String &p_class_name, EditorFileSystemDirectory::FileInfo *&r_file_info) {
@@ -1812,6 +1817,10 @@ void EditorFileSystem::_update_files_icon_path(EditorFileSystemDirectory *edp) {
void EditorFileSystem::_update_script_classes() {
if (update_script_paths.is_empty()) {
// Ensure the global class file is always present; it's essential for exports to work.
if (!FileAccess::exists(ProjectSettings::get_singleton()->get_global_class_list_path())) {
ScriptServer::save_global_classes();
}
return;
}