summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-12 08:26:47 +0200
committerGitHub <noreply@github.com>2021-10-12 08:26:47 +0200
commit1bd6a2f0200acdab0fb595b614756cc09fc1d2d7 (patch)
treed864cf18a3c985fa1a130d810dfc8ffc0c5bc78b /core
parentf9aec342dcd51d65c5970dd395e3c7a66cac446c (diff)
parent3e44a6375e775c34898acefd17ffde0116d3b533 (diff)
Merge pull request #52548 from m4gr3d/customize_metadata_dir_master
Make the project data directory customizable
Diffstat (limited to 'core')
-rw-r--r--core/config/project_settings.cpp10
-rw-r--r--core/config/project_settings.h2
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;