1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

Merge pull request #25773 from neikeq/xx

Do not initialize Mono if 'res://.mono/' and mscorlib are missing
This commit is contained in:
Ignacio Etcheverry
2019-02-10 19:08:28 +01:00
committed by GitHub
2 changed files with 24 additions and 1 deletions

View File

@@ -124,7 +124,7 @@ void GodotSharpExport::_export_begin(const Set<String> &p_features, bool p_debug
ERR_FAIL_COND(!load_success); ERR_FAIL_COND(!load_success);
Vector<String> search_dirs; Vector<String> search_dirs;
GDMonoAssembly::fill_search_dirs(search_dirs); GDMonoAssembly::fill_search_dirs(search_dirs, build_config);
Error depend_error = _get_assembly_dependencies(scripts_assembly, search_dirs, dependencies); Error depend_error = _get_assembly_dependencies(scripts_assembly, search_dirs, dependencies);
ERR_FAIL_COND(depend_error != OK); ERR_FAIL_COND(depend_error != OK);
} }

View File

@@ -253,6 +253,29 @@ void GDMono::initialize() {
mono_install_unhandled_exception_hook(&unhandled_exception_hook, NULL); mono_install_unhandled_exception_hook(&unhandled_exception_hook, NULL);
#ifdef TOOLS_ENABLED
if (!DirAccess::exists("res://.mono")) {
// 'res://.mono/' is missing so there is nothing to load. We don't need to initialize mono, but
// we still do so unless mscorlib is missing (which is the case for projects that don't use C#).
String mscorlib_fname("mscorlib.dll");
Vector<String> search_dirs;
GDMonoAssembly::fill_search_dirs(search_dirs);
bool found = false;
for (int i = 0; i < search_dirs.size(); i++) {
if (FileAccess::exists(search_dirs[i].plus_file(mscorlib_fname))) {
found = true;
break;
}
}
if (!found)
return; // mscorlib is missing, do not initialize mono
}
#endif
root_domain = mono_jit_init_version("GodotEngine.RootDomain", "v4.0.30319"); root_domain = mono_jit_init_version("GodotEngine.RootDomain", "v4.0.30319");
ERR_EXPLAIN("Mono: Failed to initialize runtime"); ERR_EXPLAIN("Mono: Failed to initialize runtime");