diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-08-01 00:06:41 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-08-01 00:06:41 +0200 |
commit | 7e1b74b5f6d7338366873f1acd98b03119663113 (patch) | |
tree | f54c49ce29db4d425b8aacd6d87d8c7060731742 | |
parent | 6e50da8a377437f3ae42f2bba57e574991293b6d (diff) | |
parent | 1ed723bd19b62d90599dc2da8f5c85352fb0880d (diff) | |
download | redot-engine-7e1b74b5f6d7338366873f1acd98b03119663113.tar.gz |
Merge pull request #94991 from Hilderin/fix-global-script-class-file-no-class
Fix global class cache file not present when no class name
-rw-r--r-- | core/object/script_language.cpp | 4 | ||||
-rw-r--r-- | core/object/script_language.h | 1 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 9 |
3 files changed, 9 insertions, 5 deletions
diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 0b528e908a..cdc56e5ec5 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -491,10 +491,6 @@ void ScriptServer::save_global_classes() { ProjectSettings::get_singleton()->store_global_class_list(gcarr); } -String ScriptServer::get_global_class_cache_file_path() { - return ProjectSettings::get_singleton()->get_global_class_list_path(); -} - //////////////////// ScriptCodeCompletionCache *ScriptCodeCompletionCache::singleton = nullptr; diff --git a/core/object/script_language.h b/core/object/script_language.h index 223f114150..59a43a7b29 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -97,7 +97,6 @@ public: static void get_global_class_list(List<StringName> *r_global_classes); static void get_inheriters_list(const StringName &p_base_type, List<StringName> *r_classes); static void save_global_classes(); - static String get_global_class_cache_file_path(); static void init_languages(); static void finish_languages(); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index a99e1dc731..e776291b2d 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -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; } |