diff options
author | ne0fhyk <fhuyakou@gmail.com> | 2021-09-10 08:32:29 -0700 |
---|---|---|
committer | ne0fhyk <fhuyakou@gmail.com> | 2021-10-11 14:40:14 -0700 |
commit | 3e44a6375e775c34898acefd17ffde0116d3b533 (patch) | |
tree | d0e162c744845660f3ec9b8334c825841bf279c1 /core/config | |
parent | f930d54140c65cedc1d24b2907f8ae33c39b76f0 (diff) |
Make the project data directory customizable.
Diffstat (limited to 'core/config')
-rw-r--r-- | core/config/project_settings.cpp | 10 | ||||
-rw-r--r-- | core/config/project_settings.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 57833fe42f..562cbbdd27 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -49,12 +49,11 @@ ProjectSettings *ProjectSettings::get_singleton() { } String ProjectSettings::get_project_data_dir_name() const { - return ".godot"; + return project_data_dir_name; } String ProjectSettings::get_project_data_path() const { - String project_data_dir_name = get_project_data_dir_name(); - return "res://" + project_data_dir_name; + return "res://" + get_project_data_dir_name(); } String ProjectSettings::get_resource_path() const { @@ -520,6 +519,10 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo _load_settings_text(custom_settings); } } + + // Updating the default value after the project settings have loaded. + project_data_dir_name = GLOBAL_GET("application/config/project_data_dir_name"); + // Using GLOBAL_GET on every block for compressing can be slow, so assigning here. Compression::zstd_long_distance_matching = GLOBAL_GET("compression/formats/zstd/long_distance_matching"); Compression::zstd_level = GLOBAL_GET("compression/formats/zstd/compression_level"); @@ -1091,6 +1094,7 @@ ProjectSettings::ProjectSettings() { custom_prop_info["application/run/main_scene"] = PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res"); GLOBAL_DEF("application/run/disable_stdout", false); GLOBAL_DEF("application/run/disable_stderr", false); + project_data_dir_name = GLOBAL_DEF_RST("application/config/project_data_dir_name", ".godot"); GLOBAL_DEF("application/config/use_custom_user_dir", false); GLOBAL_DEF("application/config/custom_user_dir_name", ""); GLOBAL_DEF("application/config/project_settings_override", ""); diff --git a/core/config/project_settings.h b/core/config/project_settings.h index b642051402..82f04b94df 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -93,6 +93,8 @@ protected: OrderedHashMap<StringName, AutoloadInfo> autoloads; + String project_data_dir_name; + bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; |