Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patches load with project settings. #65017

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,21 @@ 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 err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override);
if (err == OK && !p_ignore_override) {
String patches_config = GLOBAL_GET("application/config/patches_config");
if (!patches_config.is_empty()) {
Ref<ConfigFile> config;
config.instantiate();
if (config->load(patches_config) == OK && config->has_section("patches")) {
String path = String(config->get_value("patches", "path", patches_config.get_base_dir()));
PackedStringArray files = PackedStringArray(config->get_value("patches", "files"));
if (!files.is_empty()) {
for (const String &file : files) {
_load_resource_pack(path.path_join(file));
}
_load_settings_text_or_binary("res://project.godot", "res://project.binary");
}
}
}
String custom_settings = GLOBAL_GET("application/config/project_settings_override");
if (!custom_settings.is_empty()) {
_load_settings_text(custom_settings);
Expand Down Expand Up @@ -1443,6 +1458,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/patches_config", "");

GLOBAL_DEF("application/run/main_loop_type", "SceneTree");
GLOBAL_DEF("application/config/auto_accept_quit", true);
Expand Down
3 changes: 3 additions & 0 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@
<member name="application/config/name_localized" type="Dictionary" setter="" getter="" default="{}">
Translations of the project's name. This setting is used by OS tools to translate application name on Android, iOS and macOS.
</member>
<member name="application/config/patches_config" type="String" setter="" getter="" default="&quot;&quot;">
Specifies a configuration file for load patches. For example: [code]user://patches.cfg[/code]. This file must contain a "patches" section with a "files" key. Optional "path" key can be used if the patches are not in the same folder as the configuration file.
</member>
<member name="application/config/project_settings_override" type="String" setter="" getter="" default="&quot;&quot;">
Specifies a file to override project settings. For example: [code]user://custom_settings.cfg[/code]. See "Overriding" in the [ProjectSettings] class description at the top for more information.
[b]Note:[/b] Regardless of this setting's value, [code]res://override.cfg[/code] will still be read to override the project settings.
Expand Down
Loading