Display an alert when attempting to run a project with no main scene

This gives visual feedback when not starting Godot from a terminal.
This could lead to confusion when placing a Godot binary within a
project folder that has no main scene defined.
This commit is contained in:
Hugo Locurcio 2021-09-01 16:19:25 +02:00
parent a92c58ed3e
commit 87fb9297e3
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C

View file

@ -1090,7 +1090,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
editor = false; editor = false;
#else #else
const String error_msg = "Error: Couldn't load project data at path \"" + project_path + "\". Is the .pck file missing?\nIf you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).\n"; const String error_msg = "Error: Couldn't load project data at path \"" + project_path + "\". Is the .pck file missing?\nIf you've renamed the executable, the associated .pck file should also be renamed to match the executable's name (without the extension).\n";
OS::get_singleton()->print("%s", error_msg.ascii().get_data()); OS::get_singleton()->print("%s", error_msg.utf8().get_data());
OS::get_singleton()->alert(error_msg); OS::get_singleton()->alert(error_msg);
goto error; goto error;
@ -1184,7 +1184,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
if (!editor && !project_manager) { if (!editor && !project_manager) {
#endif #endif
OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); const String error_msg = "Error: Can't run project: no main scene defined in the project.\n";
OS::get_singleton()->print("%s", error_msg.utf8().get_data());
OS::get_singleton()->alert(error_msg);
goto error; goto error;
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
} }