Ignore command line --build-solutions when not editing project

This option is meant to use together with `--path` or from a project
folder. Otherwise the project manager is opened and the option triggers
a crash.

Fixes #25589.
This commit is contained in:
Rémi Verschelde 2020-01-13 13:55:54 +01:00
parent 087ffc8b5a
commit d88103172c

View File

@ -292,7 +292,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --export-pack <preset> <path> Same as --export, but only export the game pack for the given preset. The <path> extension determines whether it will be in PCK or ZIP format.\n");
OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n");
OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects).\n");
OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n");
#ifdef DEBUG_METHODS_ENABLED
OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
#endif
@ -2112,8 +2112,12 @@ bool Main::iteration() {
#ifdef TOOLS_ENABLED
if (auto_build_solutions) {
auto_build_solutions = false;
// Only relevant when running the editor.
if (!editor) {
ERR_FAIL_V_MSG(true, "Command line option --build-solutions was passed, but no project is being edited. Aborting.");
}
if (!EditorNode::get_singleton()->call_build()) {
ERR_FAIL_V(true);
ERR_FAIL_V_MSG(true, "Command line option --build-solutions was passed, but the build callback failed. Aborting.");
}
}
#endif