diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-04 11:52:32 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-04 11:52:32 +0200 |
commit | 9ed83995143f5d95038cdf3a9f1d5dc7b3bb6f73 (patch) | |
tree | b912994ea1fc445a83b2a27324eab732b6f870e4 | |
parent | 629e91acff36c8e87eed7854c784c1b227d9b254 (diff) | |
parent | baec8da3b35c40f7ce5b2fbca60d4326b2faabca (diff) | |
download | redot-engine-9ed83995143f5d95038cdf3a9f1d5dc7b3bb6f73.tar.gz |
Merge pull request #91509 from akien-mga/dotnet-fix-generating-glue-in-project-folder
.NET: Prevent generating mono glue in project folder
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index db86693a58..d46160127d 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -4859,7 +4859,7 @@ static void handle_cmdline_options(String glue_dir_path) { } static void cleanup_and_exit_godot() { - // Exit once done + // Exit once done. Main::cleanup(true); ::exit(0); } @@ -4878,7 +4878,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) elem = elem->next(); } else { ERR_PRINT(generate_all_glue_option + ": No output directory specified (expected path to '{GODOT_ROOT}/modules/mono/glue')."); - // Exit once done with invalid command line arguments + // Exit once done with invalid command line arguments. cleanup_and_exit_godot(); } @@ -4889,8 +4889,14 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args) } if (glue_dir_path.length()) { - handle_cmdline_options(glue_dir_path); - // Exit once done + if (Engine::get_singleton()->is_editor_hint() || + Engine::get_singleton()->is_project_manager_hint()) { + handle_cmdline_options(glue_dir_path); + } else { + // Running from a project folder, which doesn't make sense and crashes. + ERR_PRINT(generate_all_glue_option + ": Cannot generate Mono glue while running a game project. Change current directory or enable --editor."); + } + // Exit once done. cleanup_and_exit_godot(); } } |