From 25f78a5eb6de4a4918611ffc09e18f70ad6e57a3 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 23 Jul 2024 23:46:14 +0300 Subject: [PATCH] Replace .NET detection code with `ClassDB::class_exists("CSharpScript")`. --- core/config/project_settings.cpp | 2 +- editor/editor_asset_installer.cpp | 2 +- platform/macos/export/export_plugin.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index e59f79fcc80..37a2608c102 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1491,7 +1491,7 @@ ProjectSettings::ProjectSettings() { PackedStringArray extensions; extensions.push_back("gd"); - if (Engine::get_singleton()->has_singleton("GodotSharp")) { + if (ClassDB::class_exists("CSharpScript")) { extensions.push_back("cs"); } extensions.push_back("gdshader"); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index 8662ad75b2c..33049b6bc23 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -632,7 +632,7 @@ void EditorAssetInstaller::_notification(int p_what) { extension_icon_map["gdshader"] = get_editor_theme_icon(SNAME("Shader")); extension_icon_map["gdshaderinc"] = get_editor_theme_icon(SNAME("TextFile")); extension_icon_map["gd"] = get_editor_theme_icon(SNAME("GDScript")); - if (Engine::get_singleton()->has_singleton("GodotSharp")) { + if (ClassDB::class_exists("CSharpScript")) { extension_icon_map["cs"] = get_editor_theme_icon(SNAME("CSharpScript")); } else { // Mark C# support as unavailable. diff --git a/platform/macos/export/export_plugin.cpp b/platform/macos/export/export_plugin.cpp index a934e991a19..b5704d22e7d 100644 --- a/platform/macos/export/export_plugin.cpp +++ b/platform/macos/export/export_plugin.cpp @@ -141,7 +141,7 @@ String EditorExportPlatformMacOS::get_export_option_warning(const EditorExportPr if (p_name == "codesign/codesign") { if (dist_type == 2) { - if (codesign_tool == 2 && Engine::get_singleton()->has_singleton("GodotSharp")) { + if (codesign_tool == 2 && ClassDB::class_exists("CSharpScript")) { return TTR("'rcodesign' doesn't support signing applications with embedded dynamic libraries (GDExtension or .NET)."); } if (codesign_tool == 0) { @@ -333,7 +333,7 @@ bool EditorExportPlatformMacOS::get_export_option_visibility(const EditorExportP } // These entitlements are required to run managed code, and are always enabled in Mono builds. - if (Engine::get_singleton()->has_singleton("GodotSharp")) { + if (ClassDB::class_exists("CSharpScript")) { if (p_option == "codesign/entitlements/allow_jit_code_execution" || p_option == "codesign/entitlements/allow_unsigned_executable_memory" || p_option == "codesign/entitlements/allow_dyld_environment_variables") { return false; } @@ -1989,7 +1989,7 @@ Error EditorExportPlatformMacOS::export_project(const Ref &p ent_f->store_line(""); ent_f->store_line(""); ent_f->store_line(""); - if (Engine::get_singleton()->has_singleton("GodotSharp")) { + if (ClassDB::class_exists("CSharpScript")) { // These entitlements are required to run managed code, and are always enabled in Mono builds. ent_f->store_line("com.apple.security.cs.allow-jit"); ent_f->store_line("");