diff --git a/main/main.cpp b/main/main.cpp index 2810c237056..662f0bf303c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -347,6 +347,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph Vector breakpoints; bool use_custom_res = true; bool force_res = false; + bool found_project = false; packed_data = PackedData::get_singleton(); if (!packed_data) @@ -755,7 +756,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph #endif - if (globals->setup(game_path, main_pack, upwards) != OK) { + if (globals->setup(game_path, main_pack, upwards) == OK) { + found_project = true; + } else { #ifdef TOOLS_ENABLED editor = false; @@ -763,15 +766,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data()); goto error; -#endif - } else if (String(GLOBAL_DEF("application/run/main_scene", "")) == "") { -#ifdef TOOLS_ENABLED - if (!editor) { -#endif - OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); - goto error; -#ifdef TOOLS_ENABLED - } #endif } @@ -791,6 +785,26 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph init_maximized = true; video_mode.maximized = true; } + } + + if (!project_manager) { + // Determine if the project manager should be requested + project_manager = main_args.size() == 0 && !found_project; + } +#endif + + if (main_args.size() == 0 && String(GLOBAL_DEF("application/run/main_scene", "")) == "") { +#ifdef TOOLS_ENABLED + if (!editor && !project_manager) { +#endif + OS::get_singleton()->print("Error: Can't run project: no main scene defined.\n"); + goto error; +#ifdef TOOLS_ENABLED + } +#endif + } + + if (editor || project_manager) { use_custom_res = false; }