1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

.NET: Prevent generating mono glue in project folder

Fixes #83128.
This commit is contained in:
Rémi Verschelde
2024-05-03 14:23:08 +02:00
parent 03e6fbb010
commit baec8da3b3

View File

@@ -4859,7 +4859,7 @@ static void handle_cmdline_options(String glue_dir_path) {
} }
static void cleanup_and_exit_godot() { static void cleanup_and_exit_godot() {
// Exit once done // Exit once done.
Main::cleanup(true); Main::cleanup(true);
::exit(0); ::exit(0);
} }
@@ -4878,7 +4878,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
elem = elem->next(); elem = elem->next();
} else { } else {
ERR_PRINT(generate_all_glue_option + ": No output directory specified (expected path to '{GODOT_ROOT}/modules/mono/glue')."); 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(); cleanup_and_exit_godot();
} }
@@ -4889,8 +4889,14 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
} }
if (glue_dir_path.length()) { if (glue_dir_path.length()) {
handle_cmdline_options(glue_dir_path); if (Engine::get_singleton()->is_editor_hint() ||
// Exit once done 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(); cleanup_and_exit_godot();
} }
} }