Skip to content

Commit 7e1b74b

Browse files
committed
Merge pull request #94991 from Hilderin/fix-global-script-class-file-no-class
Fix global class cache file not present when no class name
2 parents 6e50da8 + 1ed723b commit 7e1b74b

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

core/object/script_language.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,6 @@ void ScriptServer::save_global_classes() {
491491
ProjectSettings::get_singleton()->store_global_class_list(gcarr);
492492
}
493493

494-
String ScriptServer::get_global_class_cache_file_path() {
495-
return ProjectSettings::get_singleton()->get_global_class_list_path();
496-
}
497-
498494
////////////////////
499495

500496
ScriptCodeCompletionCache *ScriptCodeCompletionCache::singleton = nullptr;

core/object/script_language.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class ScriptServer {
9797
static void get_global_class_list(List<StringName> *r_global_classes);
9898
static void get_inheriters_list(const StringName &p_base_type, List<StringName> *r_classes);
9999
static void save_global_classes();
100-
static String get_global_class_cache_file_path();
101100

102101
static void init_languages();
103102
static void finish_languages();

editor/editor_file_system.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,12 +1353,17 @@ void EditorFileSystem::_thread_func_sources(void *_userdata) {
13531353

13541354
void EditorFileSystem::_remove_invalid_global_class_names(const HashSet<String> &p_existing_class_names) {
13551355
List<StringName> global_classes;
1356+
bool must_save = false;
13561357
ScriptServer::get_global_class_list(&global_classes);
13571358
for (const StringName &class_name : global_classes) {
13581359
if (!p_existing_class_names.has(class_name)) {
13591360
ScriptServer::remove_global_class(class_name);
1361+
must_save = true;
13601362
}
13611363
}
1364+
if (must_save) {
1365+
ScriptServer::save_global_classes();
1366+
}
13621367
}
13631368

13641369
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) {
18121817

18131818
void EditorFileSystem::_update_script_classes() {
18141819
if (update_script_paths.is_empty()) {
1820+
// Ensure the global class file is always present; it's essential for exports to work.
1821+
if (!FileAccess::exists(ProjectSettings::get_singleton()->get_global_class_list_path())) {
1822+
ScriptServer::save_global_classes();
1823+
}
18151824
return;
18161825
}
18171826

0 commit comments

Comments
 (0)