summaryrefslogtreecommitdiff
path: root/modules/mono/mono_gd/gd_mono.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/mono_gd/gd_mono.cpp')
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index f3e83b26b9..e98ce8f6c1 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -52,10 +52,6 @@
#include "gd_mono_marshal.h"
#include "gd_mono_utils.h"
-#ifdef TOOLS_ENABLED
-#include "main/main.h"
-#endif
-
#ifdef ANDROID_ENABLED
#include "android_mono_config.h"
#include "support/android_support.h"
@@ -143,7 +139,7 @@ void gd_mono_debug_init() {
if (Engine::get_singleton()->is_editor_hint() ||
ProjectSettings::get_singleton()->get_resource_path().is_empty() ||
- Main::is_project_manager()) {
+ Engine::get_singleton()->is_project_manager_hint()) {
if (da_args.size() == 0) {
return;
}
@@ -155,8 +151,9 @@ void gd_mono_debug_init() {
.utf8();
}
#else
- if (da_args.length() == 0)
+ if (da_args.length() == 0) {
return; // Exported games don't use the project settings to setup the debugger agent
+ }
#endif
// Debugging enabled
@@ -230,8 +227,9 @@ void GDMono::add_mono_shared_libs_dir_to_path() {
path_value += mono_reg_info.bin_dir;
}
#else
- if (DirAccess::exists(bundled_bin_dir))
+ if (DirAccess::exists(bundled_bin_dir)) {
path_value += bundled_bin_dir;
+ }
#endif // TOOLS_ENABLED
#else
@@ -423,7 +421,7 @@ void GDMono::initialize_load_assemblies() {
bool tool_assemblies_loaded = _load_tools_assemblies();
CRASH_COND_MSG(!tool_assemblies_loaded, "Mono: Failed to load '" TOOLS_ASM_NAME "' assemblies.");
- if (Main::is_project_manager()) {
+ if (Engine::get_singleton()->is_project_manager_hint()) {
return;
}
#endif
@@ -504,7 +502,7 @@ void GDMono::_init_godot_api_hashes() {
}
void GDMono::_init_exception_policy() {
- PropertyInfo exc_policy_prop = PropertyInfo(Variant::INT, "mono/unhandled_exception_policy", PROPERTY_HINT_ENUM,
+ PropertyInfo exc_policy_prop = PropertyInfo(Variant::INT, "mono/runtime/unhandled_exception_policy", PROPERTY_HINT_ENUM,
vformat("Terminate Application:%s,Log Error:%s", (int)POLICY_TERMINATE_APP, (int)POLICY_LOG_ERROR));
unhandled_exception_policy = (UnhandledExceptionPolicy)(int)GLOBAL_DEF(exc_policy_prop.name, (int)POLICY_TERMINATE_APP);
ProjectSettings::get_singleton()->set_custom_property_info(exc_policy_prop.name, exc_policy_prop);
@@ -645,9 +643,8 @@ bool GDMono::copy_prebuilt_api_assembly(ApiAssemblyInfo::Type p_api_type, const
// Create destination directory if needed
if (!DirAccess::exists(dst_dir)) {
- DirAccess *da = DirAccess::create_for_path(dst_dir);
+ Ref<DirAccess> da = DirAccess::create_for_path(dst_dir);
Error err = da->make_dir_recursive(dst_dir);
- memdelete(da);
if (err != OK) {
ERR_PRINT("Failed to create destination directory for the API assemblies. Error: " + itos(err) + ".");
@@ -655,7 +652,7 @@ bool GDMono::copy_prebuilt_api_assembly(ApiAssemblyInfo::Type p_api_type, const
}
}
- DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
+ Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
String xml_file = assembly_name + ".xml";
if (da->copy(src_dir.plus_file(xml_file), dst_dir.plus_file(xml_file)) != OK) {
@@ -815,7 +812,7 @@ bool GDMono::_load_core_api_assembly(LoadedApiAssembly &r_loaded_api_assembly, c
// For the editor and the editor player we want to load it from a specific path to make sure we can keep it up to date
// If running the project manager, load it from the prebuilt API directory
- String assembly_dir = !Main::is_project_manager()
+ String assembly_dir = !Engine::get_singleton()->is_project_manager_hint()
? GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config)
: GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file(p_config);
@@ -848,7 +845,7 @@ bool GDMono::_load_editor_api_assembly(LoadedApiAssembly &r_loaded_api_assembly,
// For the editor and the editor player we want to load it from a specific path to make sure we can keep it up to date
// If running the project manager, load it from the prebuilt API directory
- String assembly_dir = !Main::is_project_manager()
+ String assembly_dir = !Engine::get_singleton()->is_project_manager_hint()
? GodotSharpDirs::get_res_assemblies_base_dir().plus_file(p_config)
: GodotSharpDirs::get_data_editor_prebuilt_api_dir().plus_file(p_config);
@@ -932,7 +929,7 @@ void GDMono::_load_api_assemblies() {
// this time update them from the prebuilt assemblies directory before trying to load them again.
// Shouldn't happen. The project manager loads the prebuilt API assemblies
- CRASH_COND_MSG(Main::is_project_manager(), "Failed to load one of the prebuilt API assemblies.");
+ CRASH_COND_MSG(Engine::get_singleton()->is_project_manager_hint(), "Failed to load one of the prebuilt API assemblies.");
// 1. Unload the scripts domain
Error domain_unload_err = _unload_scripts_domain();
@@ -1273,8 +1270,9 @@ GDMono::~GDMono() {
print_verbose("Mono: Finalizing scripts domain...");
- if (mono_domain_get() != root_domain)
+ if (mono_domain_get() != root_domain) {
mono_domain_set(root_domain, true);
+ }
finalizing_scripts_domain = true;