diff options
author | Yuri Sizov <11782833+YuriSizov@users.noreply.github.com> | 2023-03-21 14:43:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-21 14:43:14 +0100 |
commit | 0067578b5ba48be812b9c74421867ceba1bbc330 (patch) | |
tree | c23325d93d9971c3d36dc5d1fb35becef0f8ccbd /platform/android/java/lib/src | |
parent | 2a05522283fbd8ce9c887b17548debf4bcd3e8a4 (diff) | |
parent | f02e4e4091ccabe05e3eb114b888c2ede86ab189 (diff) | |
download | redot-engine-0067578b5ba48be812b9c74421867ceba1bbc330.tar.gz |
Merge pull request #75146 from m4gr3d/fix_directory_access_with_all_files_access_permission_main
Fix directory access when the running app has the `All files access` permission
Diffstat (limited to 'platform/android/java/lib/src')
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt index 833ab40af0..8ee3d5f48f 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt +++ b/platform/android/java/lib/src/org/godotengine/godot/io/StorageScope.kt @@ -76,6 +76,13 @@ internal enum class StorageScope { return UNKNOWN } + // If we have 'All Files Access' permission, we can access all directories without + // restriction. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R + && Environment.isExternalStorageManager()) { + return APP + } + val canonicalPathFile = pathFile.canonicalPath if (internalAppDir != null && canonicalPathFile.startsWith(internalAppDir)) { @@ -90,7 +97,7 @@ internal enum class StorageScope { return APP } - var rootDir: String? = System.getenv("ANDROID_ROOT") + val rootDir: String? = System.getenv("ANDROID_ROOT") if (rootDir != null && canonicalPathFile.startsWith(rootDir)) { return APP } |