-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Use case
Out app can potentially download a lot of media to show locally. We cache this data locally to avoid unnecessary round-trips.
We try to store the data in a platform-standard cache directory so that it can be cleared by the system e.g. when the system is running out of space.
On Linux the proper place to store the data would be in the user's ~/.cache directory, but there's currently no way to retrieve it from path_provider.
I believe there are equivalent directories on macOS (~/Library/Caches?) and Windows (%LOCALAPPDATA%?).
The closest candidate is getTemporaryDirectory() which (on my Linux system) returns /tmp, potentially exposing the user's data in multiuser systems.
Proposal
A new method called getApplicationCacheDirectory() analogous to the Android-only getExternalCacheDirectories().
That method could also return the first result of getExternalCacheDirectories() on Android, since it seems to always point to the current user's /sdcard/android/data/$app_id/cache.
Note: I'm willing to do this work for Linux and Android but I wanted to discuss it before starting the effort.