1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-05 17:15:09 +00:00

Merge pull request #111909 from bruvzg/mods_are_bad_they_make_you_mad

Disable some unsafe CLI arguments in template builds by default.
This commit is contained in:
Thaddeus Crews
2025-11-12 11:24:12 -06:00
8 changed files with 130 additions and 49 deletions

View File

@@ -239,7 +239,14 @@ opts.Add(BoolVariable("disable_physics_3d", "Disable 3D physics nodes and server
opts.Add(BoolVariable("disable_navigation_2d", "Disable 2D navigation features", False)) opts.Add(BoolVariable("disable_navigation_2d", "Disable 2D navigation features", False))
opts.Add(BoolVariable("disable_navigation_3d", "Disable 3D navigation features", False)) opts.Add(BoolVariable("disable_navigation_3d", "Disable 3D navigation features", False))
opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False)) opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False))
opts.Add(BoolVariable("disable_overrides", "Disable project settings overrides and related CLI arguments", False)) opts.Add(BoolVariable("disable_overrides", "Disable project settings overrides (override.cfg)", False))
opts.Add(
BoolVariable(
"disable_path_overrides",
"Disable CLI arguments to override project path/main pack/scene and run scripts (export template only)",
True,
)
)
opts.Add("build_profile", "Path to a file containing a feature build profile", "") opts.Add("build_profile", "Path to a file containing a feature build profile", "")
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "") opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True)) opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
@@ -1033,6 +1040,9 @@ if env["brotli"]:
if not env["disable_overrides"]: if not env["disable_overrides"]:
env.Append(CPPDEFINES=["OVERRIDE_ENABLED"]) env.Append(CPPDEFINES=["OVERRIDE_ENABLED"])
if env.editor_build or not env["disable_path_overrides"]:
env.Append(CPPDEFINES=["OVERRIDE_PATH_ENABLED"])
if not env["verbose"]: if not env["verbose"]:
methods.no_verbose(env) methods.no_verbose(env)

View File

@@ -650,9 +650,8 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) {
* If found, load it or fail. * If found, load it or fail.
* - Lookup project file in passed `p_path` (--path passed by the user), i.e. we * - Lookup project file in passed `p_path` (--path passed by the user), i.e. we
* are running from source code. * are running from source code.
* If not found and `p_upwards` is true (--upwards passed by the user), look for * If not found and `p_upwards` is true, look for project files in parent folders
* project files in parent folders up to the system root (used to run a game * up to the system root (used to run a game from command line while in a subfolder).
* from command line while in a subfolder).
* If a project file is found, load it or fail. * If a project file is found, load it or fail.
* If nothing was found, error out. * If nothing was found, error out.
*/ */
@@ -749,7 +748,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
#endif #endif
// Try to use the filesystem for files, according to OS. // Try to use the filesystem for files, according to OS.
// (Only Android -when reading from pck- and iOS use this.) // (Only Android -when reading from PCK-.)
if (!OS::get_singleton()->get_resource_dir().is_empty()) { if (!OS::get_singleton()->get_resource_dir().is_empty()) {
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary"); Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
@@ -822,6 +821,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
break; break;
} }
#if defined(OVERRIDE_PATH_ENABLED)
if (p_upwards) { if (p_upwards) {
// Try to load settings ascending through parent directories // Try to load settings ascending through parent directories
d->change_dir(".."); d->change_dir("..");
@@ -830,6 +830,9 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
} }
current_dir = d->get_current_dir(); current_dir = d->get_current_dir();
} else { } else {
#else
{
#endif
break; break;
} }
} }
@@ -847,12 +850,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) { Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) {
Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override); Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override);
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) { if (err == OK && !p_ignore_override) {
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
String custom_settings = GLOBAL_GET("application/config/project_settings_override"); String custom_settings = GLOBAL_GET("application/config/project_settings_override");
if (!custom_settings.is_empty()) { if (!custom_settings.is_empty()) {
_load_settings_text(custom_settings); _load_settings_text(custom_settings);
} }
} }
}
#endif
// Updating the default value after the project settings have loaded. // Updating the default value after the project settings have loaded.
bool use_hidden_directory = GLOBAL_GET("application/config/use_hidden_project_data_directory"); bool use_hidden_directory = GLOBAL_GET("application/config/use_hidden_project_data_directory");

View File

@@ -487,6 +487,9 @@ void Main::print_help_option(const char *p_option, const char *p_description, CL
case CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG: case CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG:
availability_badge = "\u001b[1;94mD"; availability_badge = "\u001b[1;94mD";
break; break;
case CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE:
availability_badge = "\u001b[1;93mX";
break;
case CLI_OPTION_AVAILABILITY_TEMPLATE_RELEASE: case CLI_OPTION_AVAILABILITY_TEMPLATE_RELEASE:
availability_badge = "\u001b[1;92mR"; availability_badge = "\u001b[1;92mR";
break; break;
@@ -529,6 +532,9 @@ void Main::print_help(const char *p_binary) {
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED
OS::get_singleton()->print(" \u001b[1;94mD\u001b[0m Available in editor builds and debug export templates only.\n"); OS::get_singleton()->print(" \u001b[1;94mD\u001b[0m Available in editor builds and debug export templates only.\n");
#endif #endif
#if defined(OVERRIDE_PATH_ENABLED)
OS::get_singleton()->print(" \u001b[1;93mX\u001b[0m Only available in editor builds, and export templates compiled with `disable_path_overrides=false`.\n");
#endif
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
OS::get_singleton()->print(" \u001b[1;91mE\u001b[0m Only available in editor builds.\n"); OS::get_singleton()->print(" \u001b[1;91mE\u001b[0m Only available in editor builds.\n");
#endif #endif
@@ -555,21 +561,20 @@ void Main::print_help(const char *p_binary) {
print_help_option("--quit", "Quit after the first iteration.\n"); print_help_option("--quit", "Quit after the first iteration.\n");
print_help_option("--quit-after <int>", "Quit after the given number of iterations. Set to 0 to disable.\n"); print_help_option("--quit-after <int>", "Quit after the given number of iterations. Set to 0 to disable.\n");
print_help_option("-l, --language <locale>", "Use a specific locale (<locale> being a two-letter code).\n"); print_help_option("-l, --language <locale>", "Use a specific locale (<locale> being a two-letter code).\n");
print_help_option("--path <directory>", "Path to a project (<directory> must contain a \"project.godot\" file).\n"); #if defined(OVERRIDE_PATH_ENABLED)
#ifdef OVERRIDE_ENABLED print_help_option("--path <directory>", "Path to a project (<directory> must contain a \"project.godot\" file).\n", CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE);
print_help_option("--scene <path>", "Path or UID of a scene in the project that should be started.\n"); print_help_option("--scene <path>", "Path or UID of a scene in the project that should be started.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE);
print_help_option("-u, --upwards", "Scan folders upwards for project.godot file.\n"); print_help_option("--main-pack <file>", "Path to a pack (.pck) file to load.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE);
print_help_option("--main-pack <file>", "Path to a pack (.pck) file to load.\n"); #endif // defined(OVERRIDE_PATH_ENABLED)
#endif // OVERRIDE_ENABLED
#ifdef DISABLE_DEPRECATED #ifdef DISABLE_DEPRECATED
print_help_option("--render-thread <mode>", "Render thread mode (\"safe\", \"separate\").\n"); print_help_option("--render-thread <mode>", "Render thread mode (\"safe\", \"separate\").\n");
#else #else
print_help_option("--render-thread <mode>", "Render thread mode (\"unsafe\" [deprecated], \"safe\", \"separate\").\n"); print_help_option("--render-thread <mode>", "Render thread mode (\"unsafe\" [deprecated], \"safe\", \"separate\").\n");
#endif // DISABLE_DEPRECATED #endif // DISABLE_DEPRECATED
#ifdef OVERRIDE_ENABLED #if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
print_help_option("--remote-fs <address>", "Remote filesystem (<host/IP>[:<port>] address).\n"); print_help_option("--remote-fs <address>", "Remote filesystem (<host/IP>[:<port>] address).\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG);
print_help_option("--remote-fs-password <password>", "Password for remote filesystem.\n"); print_help_option("--remote-fs-password <password>", "Password for remote filesystem.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG);
#endif // OVERRIDE_ENABLED #endif // defined(DEBUG_ENABLED) || defined (TOOLS_ENABLED)
print_help_option("--audio-driver <driver>", "Audio driver ["); print_help_option("--audio-driver <driver>", "Audio driver [");
for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) { for (int i = 0; i < AudioDriverManager::get_driver_count(); i++) {
@@ -642,9 +647,11 @@ void Main::print_help(const char *p_binary) {
print_help_option("--extra-gpu-memory-tracking", "Enables additional memory tracking (see class reference for `RenderingDevice.get_driver_and_device_memory_report()` and linked methods). Currently only implemented for Vulkan. Enabling this feature may cause crashes on some systems due to buggy drivers or bugs in the Vulkan Loader. See https://github.com/godotengine/godot/issues/95967\n"); print_help_option("--extra-gpu-memory-tracking", "Enables additional memory tracking (see class reference for `RenderingDevice.get_driver_and_device_memory_report()` and linked methods). Currently only implemented for Vulkan. Enabling this feature may cause crashes on some systems due to buggy drivers or bugs in the Vulkan Loader. See https://github.com/godotengine/godot/issues/95967\n");
print_help_option("--accurate-breadcrumbs", "Force barriers between breadcrumbs. Useful for narrowing down a command causing GPU resets. Currently only implemented for Vulkan.\n"); print_help_option("--accurate-breadcrumbs", "Force barriers between breadcrumbs. Useful for narrowing down a command causing GPU resets. Currently only implemented for Vulkan.\n");
#endif #endif
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
print_help_option("--remote-debug <uri>", "Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n"); print_help_option("--remote-debug <uri>", "Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n");
#endif
print_help_option("--single-threaded-scene", "Force scene tree to run in single-threaded mode. Sub-thread groups are disabled and run on the main thread.\n"); print_help_option("--single-threaded-scene", "Force scene tree to run in single-threaded mode. Sub-thread groups are disabled and run on the main thread.\n");
#if defined(DEBUG_ENABLED) #ifdef DEBUG_ENABLED
print_help_option("--debug-collisions", "Show collision shapes when running the scene.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG); print_help_option("--debug-collisions", "Show collision shapes when running the scene.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG);
print_help_option("--debug-paths", "Show path lines when running the scene.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG); print_help_option("--debug-paths", "Show path lines when running the scene.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG);
print_help_option("--debug-navigation", "Show navigation polygons when running the scene.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG); print_help_option("--debug-navigation", "Show navigation polygons when running the scene.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG);
@@ -666,12 +673,14 @@ void Main::print_help(const char *p_binary) {
print_help_option("--editor-pseudolocalization", "Enable pseudolocalization for the editor and the project manager.\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--editor-pseudolocalization", "Enable pseudolocalization for the editor and the project manager.\n", CLI_OPTION_AVAILABILITY_EDITOR);
#endif #endif
#ifdef OVERRIDE_ENABLED #if defined(OVERRIDE_PATH_ENABLED) || defined(TESTS_ENABLED)
print_help_title("Standalone tools"); print_help_title("Standalone tools");
print_help_option("-s, --script <script>", "Run a script.\n"); #endif // defined(OVERRIDE_PATH_ENABLED) || defined(TESTS_ENABLED)
print_help_option("--main-loop <main_loop_name>", "Run a MainLoop specified by its global class name.\n"); #if defined(OVERRIDE_PATH_ENABLED)
print_help_option("--check-only", "Only parse for errors and quit (use with --script).\n"); print_help_option("-s, --script <script>", "Run a script.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE);
#endif // OVERRIDE_ENABLED print_help_option("--main-loop <main_loop_name>", "Run a MainLoop specified by its global class name.\n", CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE);
print_help_option("--check-only", "Only parse for errors and quit (use with --script).\n", CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE);
#endif // defined(OVERRIDE_PATH_ENABLED)
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
print_help_option("--import", "Starts the editor, waits for any resources to be imported, and then quits.\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--import", "Starts the editor, waits for any resources to be imported, and then quits.\n", CLI_OPTION_AVAILABILITY_EDITOR);
print_help_option("--export-release <preset> <path>", "Export the project in release mode using the given preset and output path. The preset name should match one defined in \"export_presets.cfg\".\n", CLI_OPTION_AVAILABILITY_EDITOR); print_help_option("--export-release <preset> <path>", "Export the project in release mode using the given preset and output path. The preset name should match one defined in \"export_presets.cfg\".\n", CLI_OPTION_AVAILABILITY_EDITOR);
@@ -980,6 +989,20 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->initialize(); OS::get_singleton()->initialize();
#if !defined(OVERRIDE_PATH_ENABLED) && !defined(TOOLS_ENABLED)
#ifdef MACOS_ENABLED
String new_cwd = OS::get_singleton()->get_bundle_resource_dir();
if (new_cwd.is_empty() || !new_cwd.is_absolute_path()) {
new_cwd = OS::get_singleton()->get_executable_path().get_base_dir();
}
#else
String new_cwd = OS::get_singleton()->get_executable_path().get_base_dir();
#endif
if (!new_cwd.is_empty()) {
OS::get_singleton()->set_cwd(new_cwd);
}
#endif
// Benchmark tracking must be done after `OS::get_singleton()->initialize()` as on some // Benchmark tracking must be done after `OS::get_singleton()->initialize()` as on some
// platforms, it's used to set up the time utilities. // platforms, it's used to set up the time utilities.
OS::get_singleton()->benchmark_begin_measure("Startup", "Main::Setup"); OS::get_singleton()->benchmark_begin_measure("Startup", "Main::Setup");
@@ -1036,7 +1059,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String audio_driver = ""; String audio_driver = "";
String project_path = "."; String project_path = ".";
bool upwards = false;
String debug_uri = ""; String debug_uri = "";
#if defined(TOOLS_ENABLED) && (defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED)) #if defined(TOOLS_ENABLED) && (defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED))
bool test_rd_creation = false; bool test_rd_creation = false;
@@ -1447,9 +1469,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing language argument, aborting.\n"); OS::get_singleton()->print("Missing language argument, aborting.\n");
goto error; goto error;
} }
#ifdef OVERRIDE_ENABLED
} else if (arg == "--remote-fs") { // remote filesystem } else if (arg == "--remote-fs") { // remote filesystem
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
if (N) { if (N) {
remotefs = N->get(); remotefs = N->get();
N = N->next(); N = N->next();
@@ -1457,8 +1479,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing remote filesystem address, aborting.\n"); OS::get_singleton()->print("Missing remote filesystem address, aborting.\n");
goto error; goto error;
} }
#else
ERR_PRINT(
"`--remote-fs` was specified on the command line, but this Godot binary was compiled without debug. Aborting.\n"
"To be able to use it, use the `target=template_debug` SCons option when compiling Godot.\n");
#endif // defined(DEBUG_ENABLED) || defined (TOOLS_ENABLED)
} else if (arg == "--remote-fs-password") { // remote filesystem password } else if (arg == "--remote-fs-password") { // remote filesystem password
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
if (N) { if (N) {
remotefs_pass = N->get(); remotefs_pass = N->get();
N = N->next(); N = N->next();
@@ -1466,7 +1494,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing remote filesystem password, aborting.\n"); OS::get_singleton()->print("Missing remote filesystem password, aborting.\n");
goto error; goto error;
} }
#endif // OVERRIDE_ENABLED #else
ERR_PRINT(
"`--remote-fs-password` was specified on the command line, but this Godot binary was compiled without debug. Aborting.\n"
"To be able to use it, use the `target=template_debug` SCons option when compiling Godot.\n");
goto error;
#endif // defined(DEBUG_ENABLED) || defined (TOOLS_ENABLED)
} else if (arg == "--render-thread") { // render thread mode } else if (arg == "--render-thread") { // render thread mode
if (N) { if (N) {
@@ -1654,8 +1687,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} }
#endif // MODULE_GDSCRIPT_ENABLED #endif // MODULE_GDSCRIPT_ENABLED
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
} else if (arg == "--path") { // set path of project to start or edit
} else if (arg == "--path") { // set path of project to start or edit
#if defined(OVERRIDE_PATH_ENABLED)
if (N) { if (N) {
String p = N->get(); String p = N->get();
if (OS::get_singleton()->set_cwd(p) != OK) { if (OS::get_singleton()->set_cwd(p) != OK) {
@@ -1667,10 +1701,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing relative or absolute path, aborting.\n"); OS::get_singleton()->print("Missing relative or absolute path, aborting.\n");
goto error; goto error;
} }
#ifdef OVERRIDE_ENABLED #else
} else if (arg == "-u" || arg == "--upwards") { // scan folders upwards ERR_PRINT(
upwards = true; "`--path` was specified on the command line, but this Godot binary was compiled without support for path overrides. Aborting.\n"
#endif // OVERRIDE_ENABLED "To be able to use it, use the `disable_path_overrides=no` SCons option when compiling Godot.\n");
goto error;
#endif // defined(OVERRIDE_PATH_ENABLED)
} else if (arg == "--quit") { // Auto quit at the end of the first main loop iteration } else if (arg == "--quit") { // Auto quit at the end of the first main loop iteration
quit_after = 1; quit_after = 1;
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
@@ -1685,6 +1721,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
goto error; goto error;
} }
} else if (arg.ends_with("project.godot")) { } else if (arg.ends_with("project.godot")) {
#if defined(OVERRIDE_PATH_ENABLED)
String path; String path;
String file = arg; String file = arg;
int sep = MAX(file.rfind_char('/'), file.rfind_char('\\')); int sep = MAX(file.rfind_char('/'), file.rfind_char('\\'));
@@ -1701,6 +1738,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
editor = true; editor = true;
#endif #endif
#else
ERR_PRINT(
"`project.godot` path was specified on the command line, but this Godot binary was compiled without support for path overrides. Aborting.\n"
"To be able to use it, use the `disable_path_overrides=no` SCons option when compiling Godot.\n");
goto error;
#endif // defined(OVERRIDE_PATH_ENABLED)
} else if (arg == "-b" || arg == "--breakpoints") { // add breakpoints } else if (arg == "-b" || arg == "--breakpoints") { // add breakpoints
if (N) { if (N) {
@@ -1741,8 +1784,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing time scale argument, aborting.\n"); OS::get_singleton()->print("Missing time scale argument, aborting.\n");
goto error; goto error;
} }
#ifdef OVERRIDE_ENABLED
} else if (arg == "--main-pack") { } else if (arg == "--main-pack") {
#if defined(OVERRIDE_PATH_ENABLED) || defined(WEB_ENABLED) // Note: main-pack is always used on web and can't be disabled.
if (N) { if (N) {
main_pack = N->get(); main_pack = N->get();
N = N->next(); N = N->next();
@@ -1750,7 +1793,13 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing path to main pack file, aborting.\n"); OS::get_singleton()->print("Missing path to main pack file, aborting.\n");
goto error; goto error;
} }
#endif // OVERRIDE_ENABLED #else
ERR_PRINT(
"`--main-pack` was specified on the command line, but this Godot binary was compiled without support for path overrides. Aborting.\n"
"To be able to use it, use the `disable_path_overrides=no` SCons option when compiling Godot.\n");
goto error;
#endif // defined(OVERRIDE_PATH_ENABLED) || defined(WEB_ENABLED)
} else if (arg == "-d" || arg == "--debug") { } else if (arg == "-d" || arg == "--debug") {
debug_uri = "local://"; debug_uri = "local://";
OS::get_singleton()->_debug_stdout = true; OS::get_singleton()->_debug_stdout = true;
@@ -1769,14 +1818,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
StringName::set_debug_stringnames(true); StringName::set_debug_stringnames(true);
} else if (arg == "--debug-mute-audio") { } else if (arg == "--debug-mute-audio") {
debug_mute_audio = true; debug_mute_audio = true;
#endif #endif // defined(DEBUG_ENABLED)
#if defined(TOOLS_ENABLED) && (defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED)) #if defined(TOOLS_ENABLED) && (defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED))
} else if (arg == "--test-rd-support") { } else if (arg == "--test-rd-support") {
test_rd_support = true; test_rd_support = true;
} else if (arg == "--test-rd-creation") { } else if (arg == "--test-rd-creation") {
test_rd_creation = true; test_rd_creation = true;
#endif #endif // defined(TOOLS_ENABLED) && (defined(WINDOWS_ENABLED) || defined(LINUXBSD_ENABLED))
} else if (arg == "--remote-debug") { } else if (arg == "--remote-debug") {
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
if (N) { if (N) {
debug_uri = N->get(); debug_uri = N->get();
if (!debug_uri.contains("://")) { // wrong address if (!debug_uri.contains("://")) { // wrong address
@@ -1789,6 +1839,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing remote debug host address, aborting.\n"); OS::get_singleton()->print("Missing remote debug host address, aborting.\n");
goto error; goto error;
} }
#else
ERR_PRINT(
"`--remote-debug` was specified on the command line, but this Godot binary was compiled without debug. Aborting.\n"
"To be able to use it, use the `target=template_debug` SCons option when compiling Godot.\n");
goto error;
#endif // defined(DEBUG_ENABLED) || defined (TOOLS_ENABLED)
} else if (arg == "--editor-pid") { // not exposed to user } else if (arg == "--editor-pid") { // not exposed to user
if (N) { if (N) {
editor_pid = N->get().to_int(); editor_pid = N->get().to_int();
@@ -1931,7 +1987,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
} }
#endif #endif
#ifdef OVERRIDE_ENABLED #if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
// Network file system needs to be configured before globals, since globals are based on the // Network file system needs to be configured before globals, since globals are based on the
// 'project.godot' file which will only be available through the network if this is enabled // 'project.godot' file which will only be available through the network if this is enabled
if (!remotefs.is_empty()) { if (!remotefs.is_empty()) {
@@ -1949,10 +2005,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
goto error; goto error;
} }
} }
#endif // OVERRIDE_ENABLED #endif // defined(DEBUG_ENABLED) || defined (TOOLS_ENABLED)
OS::get_singleton()->_in_editor = editor; OS::get_singleton()->_in_editor = editor;
if (globals->setup(project_path, main_pack, upwards, editor) == OK) { if (globals->setup(project_path, main_pack, false, editor) == OK) {
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
found_project = true; found_project = true;
#endif #endif
@@ -3843,15 +3899,22 @@ int Main::start() {
} else if (E->get() == "--install-android-build-template") { } else if (E->get() == "--install-android-build-template") {
install_android_build_template = true; install_android_build_template = true;
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
#ifdef OVERRIDE_ENABLED
} else if (E->get() == "--scene") { } else if (E->get() == "--scene") {
#if defined(OVERRIDE_PATH_ENABLED)
E = E->next(); E = E->next();
if (E) { if (E) {
game_path = ResourceUID::ensure_path(E->get()); game_path = ResourceUID::ensure_path(E->get());
} else { } else {
ERR_FAIL_V_MSG(EXIT_FAILURE, "Missing scene path, aborting."); ERR_FAIL_V_MSG(EXIT_FAILURE, "Missing scene path, aborting.");
} }
#else
ERR_PRINT(
"`--scene` was specified on the command line, but this Godot binary was compiled without support for path overrides. Aborting.\n"
"To be able to use it, use the `disable_path_overrides=no` SCons option when compiling Godot.\n");
return EXIT_FAILURE;
#endif // defined(OVERRIDE_PATH_ENABLED)
} else if (E->get().length() && E->get()[0] != '-' && positional_arg.is_empty() && game_path.is_empty()) { } else if (E->get().length() && E->get()[0] != '-' && positional_arg.is_empty() && game_path.is_empty()) {
#if defined(OVERRIDE_PATH_ENABLED)
positional_arg = E->get(); positional_arg = E->get();
String scene_path = ResourceUID::ensure_path(E->get()); String scene_path = ResourceUID::ensure_path(E->get());
@@ -3868,7 +3931,12 @@ int Main::start() {
// for non-game applications. // for non-game applications.
game_path = scene_path; game_path = scene_path;
} }
#endif // OVERRIDE_ENABLED #else
ERR_PRINT(
"Scene path was specified on the command line, but this Godot binary was compiled without support for path overrides. Aborting.\n"
"To be able to use it, use the `disable_path_overrides=no` SCons option when compiling Godot.\n");
return EXIT_FAILURE;
#endif // defined(OVERRIDE_PATH_ENABLED)
} }
// Then parameters that have an argument to the right. // Then parameters that have an argument to the right.
else if (E->next()) { else if (E->next()) {
@@ -4073,7 +4141,7 @@ int Main::start() {
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
#ifdef OVERRIDE_ENABLED #if defined(OVERRIDE_PATH_ENABLED)
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override"); bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (disable_override) { if (disable_override) {
script = String(); script = String();
@@ -4084,7 +4152,7 @@ int Main::start() {
script = String(); script = String();
game_path = String(); game_path = String();
main_loop_type = String(); main_loop_type = String();
#endif // OVERRIDE_ENABLED #endif // defined(OVERRIDE_PATH_ENABLED)
if (script.is_empty() && game_path.is_empty()) { if (script.is_empty() && game_path.is_empty()) {
const String main_scene = GLOBAL_GET("application/run/main_scene"); const String main_scene = GLOBAL_GET("application/run/main_scene");

View File

@@ -41,6 +41,7 @@ class Main {
CLI_OPTION_AVAILABILITY_EDITOR, CLI_OPTION_AVAILABILITY_EDITOR,
CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG, CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG,
CLI_OPTION_AVAILABILITY_TEMPLATE_RELEASE, CLI_OPTION_AVAILABILITY_TEMPLATE_RELEASE,
CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE,
CLI_OPTION_AVAILABILITY_HIDDEN, CLI_OPTION_AVAILABILITY_HIDDEN,
}; };

View File

@@ -40,9 +40,6 @@ Use a specific locale (<locale> being a two\-letter code).
\fB\-\-path\fR <directory> \fB\-\-path\fR <directory>
Path to a project (<directory> must contain a 'project.godot' file). Path to a project (<directory> must contain a 'project.godot' file).
.TP .TP
\fB\-u\fR, \fB\-\-upwards\fR
Scan folders upwards for project.godot file.
.TP
\fB\-\-main\-pack\fR <file> \fB\-\-main\-pack\fR <file>
Path to a pack (.pck) file to load. Path to a pack (.pck) file to load.
.TP .TP

View File

@@ -37,7 +37,6 @@ _arguments \
'--quit[quit after the first iteration]' \ '--quit[quit after the first iteration]' \
'(-l --language)'{-l,--language}'[use a specific locale (<locale> being a two-letter code)]:two-letter locale code' \ '(-l --language)'{-l,--language}'[use a specific locale (<locale> being a two-letter code)]:two-letter locale code' \
"--path[path to a project (<directory> must contain a 'project.godot' file)]:path to directory with 'project.godot' file:_dirs" \ "--path[path to a project (<directory> must contain a 'project.godot' file)]:path to directory with 'project.godot' file:_dirs" \
'(-u --upwards)'{-u,--upwards}'[scan folders upwards for project.godot file]' \
'--main-pack[path to a pack (.pck) file to load]:path to .pck file:_files' \ '--main-pack[path to a pack (.pck) file to load]:path to .pck file:_files' \
'--render-thread[set the render thread mode]:render thread mode:(unsafe safe separate)' \ '--render-thread[set the render thread mode]:render thread mode:(unsafe safe separate)' \
'--remote-fs[use a remote filesystem]:remote filesystem address' \ '--remote-fs[use a remote filesystem]:remote filesystem address' \

View File

@@ -40,7 +40,6 @@ _complete_godot_options() {
--quit --quit
--language --language
--path --path
--upwards
--main-pack --main-pack
--render-thread --render-thread
--remote-fs --remote-fs

View File

@@ -53,7 +53,6 @@ complete -c godot -l debug-server -d "Start the editor debug server (<protocol>:
complete -c godot -l quit -d "Quit after the first iteration" complete -c godot -l quit -d "Quit after the first iteration"
complete -c godot -s l -l language -d "Use a specific locale (<locale> being a two-letter code)" -x complete -c godot -s l -l language -d "Use a specific locale (<locale> being a two-letter code)" -x
complete -c godot -l path -d "Path to a project (<directory> must contain a 'project.godot' file)" -r complete -c godot -l path -d "Path to a project (<directory> must contain a 'project.godot' file)" -r
complete -c godot -s u -l upwards -d "Scan folders upwards for project.godot file"
complete -c godot -l main-pack -d "Path to a pack (.pck) file to load" -r complete -c godot -l main-pack -d "Path to a pack (.pck) file to load" -r
complete -c godot -l render-thread -d "Set the render thread mode" -x -a "unsafe safe separate" complete -c godot -l render-thread -d "Set the render thread mode" -x -a "unsafe safe separate"
complete -c godot -l remote-fs -d "Use a remote filesystem (<host/IP>[:<port>] address)" -x complete -c godot -l remote-fs -d "Use a remote filesystem (<host/IP>[:<port>] address)" -x