From d17ba9a1409464e9de5b84acb7e67f0b21d82a39 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Fri, 15 Feb 2019 18:49:04 +0100 Subject: [PATCH] Mono: Fix export template build errors Fixes #25903 --- modules/mono/godotsharp_dirs.cpp | 25 ++++++++++++++++++------- modules/mono/godotsharp_dirs.h | 5 ++++- modules/mono/mono_gd/gd_mono.cpp | 16 +++++++++++++--- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp index 3943c0c7d71..09a1fc6fbc8 100644 --- a/modules/mono/godotsharp_dirs.cpp +++ b/modules/mono/godotsharp_dirs.cpp @@ -99,7 +99,6 @@ public: String sln_filepath; String csproj_filepath; - String data_mono_bin_dir; String data_editor_tools_dir; String data_editor_prebuilt_api_dir; #endif @@ -107,6 +106,10 @@ public: String data_mono_etc_dir; String data_mono_lib_dir; +#ifdef WINDOWS_ENABLED + String data_mono_bin_dir; +#endif + private: _GodotSharpDirs() { res_data_dir = "res://.mono"; @@ -146,10 +149,13 @@ private: data_editor_prebuilt_api_dir = data_dir_root.plus_file("Api"); String data_mono_root_dir = data_dir_root.plus_file("Mono"); - data_mono_bin_dir = data_mono_root_dir.plus_file("bin"); data_mono_etc_dir = data_mono_root_dir.plus_file("etc"); data_mono_lib_dir = data_mono_root_dir.plus_file("lib"); +#ifdef WINDOWS_ENABLED + data_mono_bin_dir = data_mono_root_dir.plus_file("bin"); +#endif + #ifdef OSX_ENABLED if (!DirAccess::exists(data_editor_tools_dir)) { data_editor_tools_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Tools"); @@ -160,7 +166,6 @@ private: } if (!DirAccess::exists(data_mono_root_dir)) { - data_mono_bin_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Mono/bin"); data_mono_etc_dir = exe_dir.plus_file("../Resources/GodotSharp/Mono/etc"); data_mono_lib_dir = exe_dir.plus_file("../Frameworks/GodotSharp/Mono/lib"); } @@ -178,6 +183,10 @@ private: data_mono_etc_dir = data_mono_root_dir.plus_file("etc"); data_mono_lib_dir = data_mono_root_dir.plus_file("lib"); +#ifdef WINDOWS_ENABLED + data_mono_bin_dir = data_mono_root_dir.plus_file("bin"); +#endif + #ifdef OSX_ENABLED if (!DirAccess::exists(data_mono_root_dir)) { data_mono_etc_dir = exe_dir.plus_file("../Resources/GodotSharp/Mono/etc"); @@ -251,10 +260,6 @@ String get_project_csproj_path() { return _GodotSharpDirs::get_singleton().csproj_filepath; } -String get_data_mono_bin_dir() { - return _GodotSharpDirs::get_singleton().data_mono_bin_dir; -} - String get_data_editor_tools_dir() { return _GodotSharpDirs::get_singleton().data_editor_tools_dir; } @@ -272,4 +277,10 @@ String get_data_mono_lib_dir() { return _GodotSharpDirs::get_singleton().data_mono_lib_dir; } +#ifdef WINDOWS_ENABLED +String get_data_mono_bin_dir() { + return _GodotSharpDirs::get_singleton().data_mono_bin_dir; +} +#endif + } // namespace GodotSharpDirs diff --git a/modules/mono/godotsharp_dirs.h b/modules/mono/godotsharp_dirs.h index a038e6486cf..556df959e2a 100644 --- a/modules/mono/godotsharp_dirs.h +++ b/modules/mono/godotsharp_dirs.h @@ -53,7 +53,6 @@ String get_build_logs_dir(); String get_project_sln_path(); String get_project_csproj_path(); -String get_data_mono_bin_dir(); String get_data_editor_tools_dir(); String get_data_editor_prebuilt_api_dir(); #endif @@ -61,6 +60,10 @@ String get_data_editor_prebuilt_api_dir(); String get_data_mono_etc_dir(); String get_data_mono_lib_dir(); +#ifdef WINDOWS_ENABLED +String get_data_mono_bin_dir(); +#endif + } // namespace GodotSharpDirs #endif // GODOTSHARP_DIRS_H diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index b45046cb6d9..00850b4d948 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -157,7 +157,17 @@ void GDMono::add_mono_shared_libs_dir_to_path() { path_value += ';'; String bundled_bin_dir = GodotSharpDirs::get_data_mono_bin_dir(); - path_value += DirAccess::exists(bundled_bin_dir) ? bundled_bin_dir : mono_reg_info.bin_dir; +#ifdef TOOLS_ENABLED + if (DirAccess::exists(bundled_bin_dir)) { + path_value += bundled_bin_dir; + } else { + path_value += mono_reg_info.bin_dir; + } +#else + if (DirAccess::exists(bundled_bin_dir)) + path_value += bundled_bin_dir; +#endif // TOOLS_ENABLED + #else path_value += ':'; @@ -167,10 +177,10 @@ void GDMono::add_mono_shared_libs_dir_to_path() { } else { // TODO: Do we need to add the lib dir when using the system installed Mono on Unix platforms? } -#endif +#endif // WINDOWS_ENABLED OS::get_singleton()->set_environment(path_var, path_value); -#endif +#endif // WINDOWS_ENABLED || UNIX_ENABLED } void GDMono::initialize() {