You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add project setting and build option to disable override.cfg and related CLI arguments.
This commit is contained in:
@@ -643,11 +643,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
ERR_FAIL_COND_V_MSG(!ok, ERR_CANT_OPEN, vformat("Cannot open resource pack '%s'.", p_main_pack));
|
||||
|
||||
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
|
||||
#ifdef OVERRIDE_ENABLED
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Load override from location of the main pack
|
||||
// Optional, we don't mind if it fails
|
||||
_load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg"));
|
||||
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
|
||||
if (!disable_override) {
|
||||
_load_settings_text(p_main_pack.get_base_dir().path_join("override.cfg"));
|
||||
}
|
||||
}
|
||||
#endif // OVERRIDE_ENABLED
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -693,12 +698,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
// If we opened our package, try and load our project.
|
||||
if (found) {
|
||||
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
|
||||
#ifdef OVERRIDE_ENABLED
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Load overrides from the PCK and the executable location.
|
||||
// Optional, we don't mind if either fails.
|
||||
_load_settings_text("res://override.cfg");
|
||||
_load_settings_text(exec_path.get_base_dir().path_join("override.cfg"));
|
||||
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
|
||||
if (!disable_override) {
|
||||
_load_settings_text("res://override.cfg");
|
||||
_load_settings_text(exec_path.get_base_dir().path_join("override.cfg"));
|
||||
}
|
||||
}
|
||||
#endif // OVERRIDE_ENABLED
|
||||
return err;
|
||||
}
|
||||
}
|
||||
@@ -713,10 +723,15 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
|
||||
if (!OS::get_singleton()->get_resource_dir().is_empty()) {
|
||||
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
|
||||
#ifdef OVERRIDE_ENABLED
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Optional, we don't mind if it fails.
|
||||
_load_settings_text("res://override.cfg");
|
||||
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
|
||||
if (!disable_override) {
|
||||
_load_settings_text("res://override.cfg");
|
||||
}
|
||||
}
|
||||
#endif // OVERRIDE_ENABLED
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -736,11 +751,16 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
err = _load_settings_text_or_binary(resource_path.path_join("project.godot"), resource_path.path_join("project.binary"));
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Optional, we don't mind if it fails.
|
||||
_load_settings_text(resource_path.path_join("override.cfg"));
|
||||
#ifdef OVERRIDE_ENABLED
|
||||
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
|
||||
if (!disable_override) {
|
||||
_load_settings_text(resource_path.path_join("override.cfg"));
|
||||
}
|
||||
#endif // OVERRIDE_ENABLED
|
||||
return err;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // MACOS_ENABLED
|
||||
|
||||
// Nothing was found, try to find a project file in provided path (`p_path`)
|
||||
// or, if requested (`p_upwards`) in parent directories.
|
||||
@@ -760,7 +780,12 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
|
||||
err = _load_settings_text_or_binary(current_dir.path_join("project.godot"), current_dir.path_join("project.binary"));
|
||||
if (err == OK && !p_ignore_override) {
|
||||
// Optional, we don't mind if it fails.
|
||||
_load_settings_text(current_dir.path_join("override.cfg"));
|
||||
#ifdef OVERRIDE_ENABLED
|
||||
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
|
||||
if (!disable_override) {
|
||||
_load_settings_text(current_dir.path_join("override.cfg"));
|
||||
}
|
||||
#endif // OVERRIDE_ENABLED
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
@@ -1569,6 +1594,7 @@ ProjectSettings::ProjectSettings() {
|
||||
GLOBAL_DEF("application/config/use_custom_user_dir", false);
|
||||
GLOBAL_DEF("application/config/custom_user_dir_name", "");
|
||||
GLOBAL_DEF("application/config/project_settings_override", "");
|
||||
GLOBAL_DEF("application/config/disable_project_settings_override", false);
|
||||
|
||||
GLOBAL_DEF("application/run/main_loop_type", "SceneTree");
|
||||
GLOBAL_DEF("application/config/auto_accept_quit", true);
|
||||
|
||||
Reference in New Issue
Block a user