I am building a simple file explorer that shows folders, files, and It allows navigation between directories.
I am using “Native File” to do that work. But I experimented different behaviours between iOS and Android. I place the root of the explorer in “documentsDirectory” for iOS and “dataDirectory” or “externalDataDirectory” for Android.
The method that I am using is listDir. It has a very simple usage.
listDir(path, dirName)
Returns: Promise<Entry[]> Returns a Promise that resolves to an array of Entry objects or rejects with an error.
When I tryied it with iOS device, it worked perfectly. I navigated through the directories without any problem.
When I did it with Android device. I retrieved directories and files of the “assigned root”. But when I tried navigate inside directories inside that “root”, it always send me to the “assigned root” instead. It don’t allows to me navigate to other directories than the “assigned root”.
First I thought that It was a permissions error, but I can create directories inside that directories by using “createDir(path, dirName, replace)” and check them that they exists by using “checkDir(path, dir)”.
The structure Directories are:
dataDirectory or externalDataDirectory
- NewFolder1
- NewFolder1.1
- NewFolder1.2
- NewFolder2
But when I try to get directories into “NewFolder1”, It gets to me:
- NewFolder1
- NewFolder2
There’s someone with that problem?
Or any idea of what can happens here?
Root path:
file:///data/data/app.fileexplorer/files/
Destination path:
file:///data/data/app.fileexplorer/files/NewFolder1/
They resolved with the same Entry[]. Zero kind of errors.
Native File version: 4.3.3