diff options
author | ne0fhyk <fhuyakou@gmail.com> | 2021-07-10 18:39:31 -0700 |
---|---|---|
committer | ne0fhyk <fhuyakou@gmail.com> | 2021-08-16 23:11:56 -0700 |
commit | 3a00ff1cce403bd879cbb7e1e826b0681d79fe0f (patch) | |
tree | f5de15377676763ea363328491a3bab582b19dbd /core | |
parent | cfdac0973c2f1e5a3349c3d80262be130744384a (diff) | |
download | redot-engine-3a00ff1cce403bd879cbb7e1e826b0681d79fe0f.tar.gz |
Add partial support for Android scoped storage.
This is done by providing API access to app specific directories which don't have any limitations and allows us to bump the target sdk version to 30.
In addition, we're also bumping the min sdk version to 19 as version 18 is no longer supported by Google Play Services and only account of 0.3% of Android devices.
Diffstat (limited to 'core')
-rw-r--r-- | core/core_bind.cpp | 11 | ||||
-rw-r--r-- | core/core_bind.h | 3 | ||||
-rw-r--r-- | core/os/os.cpp | 7 | ||||
-rw-r--r-- | core/os/os.h | 3 |
4 files changed, 6 insertions, 18 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index f3f51e57ee..e1d595e98c 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -456,10 +456,6 @@ 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(); -} - 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(); @@ -483,8 +479,8 @@ bool _OS::is_debug_build() const { #endif } -String _OS::get_system_dir(SystemDir p_dir) const { - return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir)); +String _OS::get_system_dir(SystemDir p_dir, bool p_shared_storage) const { + return OS::get_singleton()->get_system_dir(OS::SystemDir(p_dir), p_shared_storage); } String _OS::get_keycode_string(uint32_t p_code) const { @@ -567,8 +563,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_system_dir", "dir", "shared_storage"), &_OS::get_system_dir, DEFVAL(true)); 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); diff --git a/core/core_bind.h b/core/core_bind.h index 9060aff340..94e8ab2a34 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -229,10 +229,9 @@ public: SYSTEM_DIR_RINGTONES, }; - String get_system_dir(SystemDir p_dir) const; + String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const; 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; diff --git a/core/os/os.cpp b/core/os/os.cpp index 76a6da51e1..63390919f4 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -277,18 +277,13 @@ 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(); } // Access system-specific dirs like Documents, Downloads, etc. -String OS::get_system_dir(SystemDir p_dir) const { +String OS::get_system_dir(SystemDir p_dir, bool p_shared_storage) const { return "."; } diff --git a/core/os/os.h b/core/os/os.h index 0466d94acd..55b21266fc 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -250,7 +250,6 @@ 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 { @@ -264,7 +263,7 @@ public: SYSTEM_DIR_RINGTONES, }; - virtual String get_system_dir(SystemDir p_dir) const; + virtual String get_system_dir(SystemDir p_dir, bool p_shared_storage = true) const; virtual Error move_to_trash(const String &p_path) { return FAILED; } |