diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-06-08 17:43:10 +0100 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-06-10 16:48:17 +0100 |
commit | b3a962945e82097fd472c6e1724785b11eaaa32f (patch) | |
tree | 71473572d7946b4eebf3650364404a07395ce037 /core | |
parent | 9539e4e39e489e750c7ec99d84b93dce283fe721 (diff) |
Add OS.get_external_data_dir() to get Android external directory
Diffstat (limited to 'core')
-rw-r--r-- | core/core_bind.cpp | 5 | ||||
-rw-r--r-- | core/core_bind.h | 1 | ||||
-rw-r--r-- | core/os/os.cpp | 5 | ||||
-rw-r--r-- | core/os/os.h | 1 |
4 files changed, 12 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index ed4387a1b9..fe0166d0e6 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -643,6 +643,10 @@ String _OS::get_user_data_dir() const { return OS::get_singleton()->get_user_data_dir(); } +String _OS::get_external_data_dir() const { + return OS::get_singleton()->get_external_data_dir(); +} + bool _OS::is_debug_build() const { #ifdef DEBUG_ENABLED return true; @@ -743,6 +747,7 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_static_memory_peak_usage"), &_OS::get_static_memory_peak_usage); 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_unique_id"), &_OS::get_unique_id); diff --git a/core/core_bind.h b/core/core_bind.h index d05353bf0f..c8b0a4d7da 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -237,6 +237,7 @@ public: String get_system_dir(SystemDir p_dir) const; String get_user_data_dir() const; + String get_external_data_dir() const; Error set_thread_name(const String &p_name); Thread::ID get_thread_caller_id() const; diff --git a/core/os/os.cpp b/core/os/os.cpp index ca1b798e11..c5463cf216 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -310,6 +310,11 @@ String OS::get_user_data_dir() const { return "."; } +// Android OS path to app's external data storage +String OS::get_external_data_dir() const { + return get_user_data_dir(); +}; + // Absolute path to res:// String OS::get_resource_dir() const { return ProjectSettings::get_singleton()->get_resource_path(); diff --git a/core/os/os.h b/core/os/os.h index 7198607237..5bf9dc9288 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -252,6 +252,7 @@ public: virtual String get_bundle_resource_dir() const; virtual String get_user_data_dir() const; + virtual String get_external_data_dir() const; virtual String get_resource_dir() const; enum SystemDir { |