itinance / itinance/react-native-fs

Add constant DownloadDirectoryPath (String) absolute path to download directory

Open
#114 1 comment 9 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

**Use Case:**

Under Android, I need to save a KML to a location accessible by the Google Earth app, so I can "Open with Earth".

RNFS.ExternalDirectoryPath is writable on Android but not accessible by other apps:
`/storage/emulated/0/Android/data/com.ditchwitch.fieldplanner/files'
`

The Download folder is writable on Android and accessible by other apps:
`/storage/emulated/0/Download
`

A hard-coded to '/storage/emulated/0/Download' will break on other devices with no SD card or perhaps multiple

Would an API to get environment variables be too out-of-scope?

The C++ cross-platform library Qt had QStandardPaths constants are usable across Android, iOS, Linux, or Windows.

http://doc.qt.io/qt-5/qstandardpaths.html

Here is what they resolve to an Android and an iOS device:

```
/// QStandardPaths | Android Nexus 7 | Path Exists
/// --------------------- | ----------------------------------------------- | -----------
/// DesktopLocation | /data/data/com.ditchwitch.tsr/files | Y
/// DocumentsLocation | /storage/emulated/0/Documents | *Not Found*
/// FontsLocation | | *Not Found*
/// ApplicationsLocation | | *Not Found*
/// MusicLocation | /storage/emulated/0/Music | *Not Found*
/// MoviesLocation | /storage/emulated/0/Movies | *Not Found*
/// PicturesLocation | /storage/emulated/0/Pictures | Y
/// TempLocation | /data/data/com.ditchwitch.tsr/cache | Y
/// HomeLocation | /data/data/com.ditchwitch.tsr/files | Y
/// DataLocation | /data/data/com.ditchwitch.tsr/files | Y
/// CacheLocation | /data/data/com.ditchwitch.tsr/cache | Y
/// GenericDataLocation | /storage/emulated/0 | Y
/// RuntimeLocation | /data/data/com.ditchwitch.tsr/cache | Y
/// ConfigLocation | /data/data/com.ditchwitch.tsr/files/settings | *Not Found*
/// DownloadLocation | /storage/emulated/0/Download | Y
/// GenericCacheLocation | /data/data/com.ditchwitch.tsr/cache | Y
/// GenericConfigLocation | /data/data/com.ditchwitch.tsr/files/settings | Y
///
///
/// QStandardPaths | iOS iPad Air | Path Exists
/// ----------------------- | ----------------------------------------------------------------------------- | --------------------
/// DesktopLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Desktop | *Not Found*
/// DocumentsLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Documents | Y
/// FontsLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/TSR.app/.fonts | *Not Found*
/// ApplicationsLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Applications | *Not Found*
/// MusicLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Music | *Not Found*
/// MoviesLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Movies | *Not Found*
/// PicturesLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Pictures | *Not Found*
/// TempLocation | /private/var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/tmp/ | Y
/// HomeLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/TSR.app | Y
/// DataLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Documents | Y
/// CacheLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Library/Caches | Y
/// GenericDataLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Documents | Y
/// RuntimeLocation | | *Not Found*
/// ConfigLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Documents | Y
/// DownloadLocation | /var/mobile/Apwpplications/68479DA3-C7A3-4077-8AB5-673B9672830B/Downloads | *Not Found*
/// GenericCacheLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Library/Caches | Y
/// GenericConfigLocation | /var/mobile/Applications/68479DA3-C7A3-4077-8AB5-673B9672830B/Documents | Y

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.