mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Fix directory access when the running app has the All files access permission
(cherry picked from commit f02e4e4091)
This commit is contained in:
parent
94e90b0593
commit
9ac978190e
1 changed files with 8 additions and 1 deletions
|
|
@ -76,6 +76,13 @@ internal enum class StorageScope {
|
||||||
return UNKNOWN
|
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
|
val canonicalPathFile = pathFile.canonicalPath
|
||||||
|
|
||||||
if (internalAppDir != null && canonicalPathFile.startsWith(internalAppDir)) {
|
if (internalAppDir != null && canonicalPathFile.startsWith(internalAppDir)) {
|
||||||
|
|
@ -90,7 +97,7 @@ internal enum class StorageScope {
|
||||||
return APP
|
return APP
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootDir: String? = System.getenv("ANDROID_ROOT")
|
val rootDir: String? = System.getenv("ANDROID_ROOT")
|
||||||
if (rootDir != null && canonicalPathFile.startsWith(rootDir)) {
|
if (rootDir != null && canonicalPathFile.startsWith(rootDir)) {
|
||||||
return APP
|
return APP
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue