summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-06-19 10:19:51 +0200
committerGitHub <noreply@github.com>2021-06-19 10:19:51 +0200
commitd587ea6020ccfd0290a5daeb5d225aac3a30e2d7 (patch)
tree90163a365407359cbe1ad9cca2aa131f6e29cea5 /core
parentf3c35f63e615d54806cb78540b12cadd0f337730 (diff)
parentaa0976f47c710f6cc1549c9dd6e930bc4ff29f96 (diff)
Merge pull request #48544 from Calinou/expose-data-dirs
Expose OS data directory getter methods
Diffstat (limited to 'core')
-rw-r--r--core/core_bind.cpp18
-rw-r--r--core/core_bind.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 60759cd71c..912512d993 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -426,6 +426,21 @@ String _OS::get_external_data_dir() const {
return OS::get_singleton()->get_external_data_dir();
}
+String _OS::get_config_dir() const {
+ // Exposed as `get_config_dir()` instead of `get_config_path()` for consistency with other exposed OS methods.
+ return OS::get_singleton()->get_config_path();
+}
+
+String _OS::get_data_dir() const {
+ // Exposed as `get_data_dir()` instead of `get_data_path()` for consistency with other exposed OS methods.
+ return OS::get_singleton()->get_data_path();
+}
+
+String _OS::get_cache_dir() const {
+ // Exposed as `get_cache_dir()` instead of `get_cache_path()` for consistency with other exposed OS methods.
+ return OS::get_singleton()->get_cache_path();
+}
+
bool _OS::is_debug_build() const {
#ifdef DEBUG_ENABLED
return true;
@@ -518,6 +533,9 @@ void _OS::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_user_data_dir"), &_OS::get_user_data_dir);
ClassDB::bind_method(D_METHOD("get_external_data_dir"), &_OS::get_external_data_dir);
ClassDB::bind_method(D_METHOD("get_system_dir", "dir"), &_OS::get_system_dir);
+ ClassDB::bind_method(D_METHOD("get_config_dir"), &_OS::get_config_dir);
+ ClassDB::bind_method(D_METHOD("get_data_dir"), &_OS::get_data_dir);
+ ClassDB::bind_method(D_METHOD("get_cache_dir"), &_OS::get_cache_dir);
ClassDB::bind_method(D_METHOD("get_unique_id"), &_OS::get_unique_id);
ClassDB::bind_method(D_METHOD("print_all_textures_by_size"), &_OS::print_all_textures_by_size);
diff --git a/core/core_bind.h b/core/core_bind.h
index b161effe95..5ab81547d7 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -230,6 +230,9 @@ public:
String get_user_data_dir() const;
String get_external_data_dir() const;
+ String get_config_dir() const;
+ String get_data_dir() const;
+ String get_cache_dir() const;
Error set_thread_name(const String &p_name);
Thread::ID get_thread_caller_id() const;