itinance / itinance/react-native-fs
How to expose DocumentDirectoryPath to my app?
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using react-native-fs to store a file in my cache directory by using the following code:
```
downloadFile = (url, name) => {
const destPath = RNFS.DocumentDirectoryPath + '/' + name;
let option = {
fromUrl: url,
toFile: destPath,
};
RNFS.downloadFile(option).promise.then(res => {
console.log('res -----------------------------> ', res);
RNFS.readDir(RNFS.DocumentDirectoryPath) // On Android, use "RNFS.DocumentDirectoryPath" (MainBundlePath is not defined)
.then(result => {
console.log('GOT RESULT', result);
});
});
};
```
The files are being stored properly, the full path being /data/user/0/com.scpush/files/image.jpg
I'm now passing this full path to a function I'm exposing to RN via Native Modules and that file can't be opened due to this error

I figure I must expose that directory to my app, and I googled around, and the best I could come up with was these two files:
**android/app/src/main/res/xml/files_paths.xml**
```
```
**android/app/src/main/res/xml/provider_paths.xml**
```
```
I'm sure I'm totally messing up here, but I can't figure where. I'm very new to RN.
In other words, how can I expose DocumentDirectoryPath to my app?
Can someone give me some help?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.