summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/main/main.cpp b/main/main.cpp
index d5c602d19f..81f2c101a1 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -94,13 +94,17 @@
#include "editor/editor_settings.h"
#include "editor/editor_translation.h"
#include "editor/progress_dialog.h"
-#include "editor/project_converter_3_to_4.h"
#include "editor/project_manager.h"
#include "editor/register_editor_types.h"
+
#ifndef NO_EDITOR_SPLASH
#include "main/splash_editor.gen.h"
#endif
-#endif
+
+#ifndef DISABLE_DEPRECATED
+#include "editor/project_converter_3_to_4.h"
+#endif // DISABLE_DEPRECATED
+#endif // TOOLS_ENABLED
#include "modules/modules_enabled.gen.h" // For mono.
@@ -164,8 +168,10 @@ static OS::ProcessID editor_pid = 0;
static bool found_project = false;
static bool auto_build_solutions = false;
static String debug_server_uri;
+#ifndef DISABLE_DEPRECATED
static int converter_max_kb_file = 4 * 1024; // 4MB
static int converter_max_line_length = 100000;
+#endif // DISABLE_DEPRECATED
HashMap<Main::CLIScope, Vector<String>> forwardable_cli_arguments;
#endif
@@ -437,10 +443,12 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" The target directory must exist.\n");
OS::get_singleton()->print(" --export-debug <preset> <path> Export the project in debug mode using the given preset and output path. See --export-release description for other considerations.\n");
OS::get_singleton()->print(" --export-pack <preset> <path> Export the project data only using the given preset and output path. The <path> extension determines whether it will be in PCK or ZIP format.\n");
+#ifndef DISABLE_DEPRECATED
OS::get_singleton()->print(" --convert-3to4 [<max_file_kb>] [<max_line_size>]\n");
OS::get_singleton()->print(" Converts project from Godot 3.x to Godot 4.x.\n");
OS::get_singleton()->print(" --validate-conversion-3to4 [<max_file_kb>] [<max_line_size>]\n");
OS::get_singleton()->print(" Shows what elements will be renamed when converting project from Godot 3.x to Godot 4.x.\n");
+#endif // DISABLE_DEPRECATED
OS::get_singleton()->print(" --doctool [<path>] Dump the engine API reference to the given <path> (defaults to current dir) 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). Implies --editor and requires a valid project to edit.\n");
@@ -1122,6 +1130,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
editor = true;
cmdline_tool = true;
main_args.push_back(I->get());
+#ifndef DISABLE_DEPRECATED
} else if (I->get() == "--convert-3to4") {
// Actually handling is done in start().
cmdline_tool = true;
@@ -1152,6 +1161,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
}
}
+#endif // DISABLE_DEPRECATED
} else if (I->get() == "--doctool") {
// Actually handling is done in start().
cmdline_tool = true;
@@ -1161,7 +1171,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
audio_driver = NULL_AUDIO_DRIVER;
display_driver = NULL_DISPLAY_DRIVER;
main_args.push_back(I->get());
-#endif
+#endif // TOOLS_ENABLED
} else if (I->get() == "--path") { // set path of project to start or edit
if (I->next()) {
@@ -2384,7 +2394,7 @@ bool Main::start() {
bool converting_project = false;
bool validating_converting_project = false;
#endif // DISABLE_DEPRECATED
-#endif
+#endif // TOOLS_ENABLED
main_timer_sync.init(OS::get_singleton()->get_ticks_usec());
List<String> args = OS::get_singleton()->get_cmdline_args();
@@ -2409,7 +2419,7 @@ bool Main::start() {
editor = true;
} else if (args[i] == "-p" || args[i] == "--project-manager") {
project_manager = true;
-#endif
+#endif // TOOLS_ENABLED
} else if (args[i].length() && args[i][0] != '-' && positional_arg.is_empty()) {
positional_arg = args[i];
@@ -2567,18 +2577,22 @@ bool Main::start() {
#ifndef DISABLE_DEPRECATED
if (converting_project) {
- int exit_code = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).convert();
- OS::get_singleton()->set_exit_code(exit_code);
+ int ret = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).convert();
+ if (ret) {
+ OS::get_singleton()->set_exit_code(EXIT_SUCCESS);
+ }
return false;
}
if (validating_converting_project) {
- int exit_code = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).validate_conversion();
- OS::get_singleton()->set_exit_code(exit_code);
+ bool ret = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).validate_conversion();
+ if (ret) {
+ OS::get_singleton()->set_exit_code(EXIT_SUCCESS);
+ }
return false;
}
#endif // DISABLE_DEPRECATED
-#endif
+#endif // TOOLS_ENABLED
if (script.is_empty() && game_path.is_empty() && String(GLOBAL_GET("application/run/main_scene")) != "") {
game_path = GLOBAL_GET("application/run/main_scene");