Skip to content

Commit 9ed8399

Browse files
committed
Merge pull request #91509 from akien-mga/dotnet-fix-generating-glue-in-project-folder
.NET: Prevent generating mono glue in project folder
2 parents 629e91a + baec8da commit 9ed8399

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

modules/mono/editor/bindings_generator.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4859,7 +4859,7 @@ static void handle_cmdline_options(String glue_dir_path) {
48594859
}
48604860

48614861
static void cleanup_and_exit_godot() {
4862-
// Exit once done
4862+
// Exit once done.
48634863
Main::cleanup(true);
48644864
::exit(0);
48654865
}
@@ -4878,7 +4878,7 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
48784878
elem = elem->next();
48794879
} else {
48804880
ERR_PRINT(generate_all_glue_option + ": No output directory specified (expected path to '{GODOT_ROOT}/modules/mono/glue').");
4881-
// Exit once done with invalid command line arguments
4881+
// Exit once done with invalid command line arguments.
48824882
cleanup_and_exit_godot();
48834883
}
48844884

@@ -4889,8 +4889,14 @@ void BindingsGenerator::handle_cmdline_args(const List<String> &p_cmdline_args)
48894889
}
48904890

48914891
if (glue_dir_path.length()) {
4892-
handle_cmdline_options(glue_dir_path);
4893-
// Exit once done
4892+
if (Engine::get_singleton()->is_editor_hint() ||
4893+
Engine::get_singleton()->is_project_manager_hint()) {
4894+
handle_cmdline_options(glue_dir_path);
4895+
} else {
4896+
// Running from a project folder, which doesn't make sense and crashes.
4897+
ERR_PRINT(generate_all_glue_option + ": Cannot generate Mono glue while running a game project. Change current directory or enable --editor.");
4898+
}
4899+
// Exit once done.
48944900
cleanup_and_exit_godot();
48954901
}
48964902
}

0 commit comments

Comments
 (0)