WeaponX86 opened a new issue #422:
URL: https://github.com/apache/cordova-plugin-file/issues/422
# Bug Report
## Problem
We can't verify all parent folders of
cordova.file.externalApplicationStorageDirectory exist on Android 11
window.resolveLocalFileSystemURL('file:///storage/') // WORKS
window.resolveLocalFileSystemURL('file:///storage/emulated/') // FAILS
window.resolveLocalFileSystemURL('file:///storage/emulated/0/') // WORKS
### What is expected to happen?
Calling window.resolveLocalFileSystemURL('file:///storage/emulated/') should
return a DirectoryEntry
### What does actually happen?
Calling window.resolveLocalFileSystemURL('file:///storage/emulated/') throws
error code 1
Output on Pixel 1 with Android 10

Output on Pixel 3 with Android 11

## Information
For our app we store all saved files inside of
cordova.file.externalApplicationStorageDirectory.
Ex. cordova.file.externalApplicationStorageDirectory + '/photos/123/'
Ex. cordova.file.externalApplicationStorageDirectory + '/photos/456/'
Ex. cordova.file.externalApplicationStorageDirectory + '/assets/123/'
Ex. cordova.file.externalApplicationStorageDirectory + '/assets/456/'
If I want to copy a file from say
cordova.file.externalApplicationStorageDirectory + '/photos/123/abc.jpg'
to
cordova.file.externalApplicationStorageDirectory + '/photos/456/def.jpg'
We recursively verify each folder exists from file:// up to see if any
folders need created. On Android <10 this has worked fine.
I tried adding android:requestLegacyExternalStorage="true" but it doesn't
help.
### Command or Code
cordova create myApp
cordova platform add android
Modify config.xml & index.js:
[https://gist.github.com/WeaponX86/6a44b481064a8c5366411923e723bcb1](url)
cordova build android --debug
### Environment, Platform, Device
Pixel 1 - Android 10
Pixel 3 - Android 11
### Version information
Cordova 10.0.0
cordova-android 9.0.0
macOS 10.15.6
npm 6.14.8
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [x] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]