Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET: Prevent generating mono glue in project folder #91509

Conversation

akien-mga
Copy link
Member

@akien-mga akien-mga commented May 3, 2024

$ cd ~/some/project
$ /Godot/godot/bin/godot.linuxbsd.editor.dev.x86_64.mono --generate-mono-glue .
ERROR: --generate-mono-glue: Cannot generate Mono glue while running a game project. Change current directory or enable --editor.
   at: handle_cmdline_args (modules/mono/editor/bindings_generator.cpp:4977)
$ /Godot/godot/bin/godot.linuxbsd.editor.dev.x86_64.mono --generate-mono-glue . -e
// works

@akien-mga akien-mga added bug topic:dotnet crash cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels May 3, 2024
@akien-mga akien-mga added this to the 4.3 milestone May 3, 2024
@akien-mga akien-mga requested a review from a team as a code owner May 3, 2024 12:24
@akien-mga akien-mga changed the title .NET: Prevent generate mono glue in project folder .NET: Prevent generating mono glue in project folder May 3, 2024
@akien-mga akien-mga force-pushed the dotnet-fix-generating-glue-in-project-folder branch from 63783f2 to baec8da Compare May 3, 2024 12:24
handle_cmdline_options(glue_dir_path);
// Exit once done
if (Engine::get_singleton()->is_editor_hint() ||
Engine::get_singleton()->is_project_manager_hint()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes me wonder if we should add complementary cases, either a is_editor_or_project_manager_hint or a is_game/running_hint or something like it, though I'm not sure how often this particular check is used, or the complement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I'd like to refactor one day, main.cpp and the whole logic to infer what mode to run based on context is very hacky.

We should change it so there's a lot more intent on what to run (can still be implicit for the user but the code flow needs to be explicit), and then we can store which run mode we're using in an enum instead of these custom bools.

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, haven't tried but the logic is valid

Copy link
Member

@raulsntos raulsntos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, thanks!

@akien-mga akien-mga merged commit 9ed8399 into godotengine:master May 4, 2024
16 checks passed
@akien-mga akien-mga deleted the dotnet-fix-generating-glue-in-project-folder branch May 4, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release crash topic:dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Godot crashes when generating mono glue if PWD is godot project
3 participants