Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access to Cache Storage files on different Operating Systems? #366

Open
LordTylus opened this issue May 16, 2023 · 0 comments
Open

Comments

@LordTylus
Copy link

LordTylus commented May 16, 2023

Hello there,

I am currently working in a small app that downloads some amount of Data from the internet and stores it locally for on demand use.

These data are non-essential for the apps basic usage and can be re-downloaded whenever they become relevant to the user again. Also they are only rarely altered on the server. In most use cases, them being outdated doesn't impact the users experience either.

For this purpose, I would like to store the files inside the Apps cache directory, so the user has an easy way of cleaning them up when needed, or in case of iOS, the system can do so when it runs low on storage space.

It is my understanding, that in both supported mobile operating systems there is a designated location for caches. On Android I would get the cacheFiles() from the Application Context which may point to:
/data/user/0/your.package.name/cache
instead of
/data/user/0/your.package.name/files

See: https://developer.android.com/training/data-storage/app-specific

and on iOS it may point to
~/Library/Caches
instead of
~/Documents

See: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

On Windows, I would probably just like to drop them into the Users Local Temp file which is located in
%LOCALAPPDATA%\Temp instead of for example the installation directory or the Users Documents or Roaming directories.

I have examined the StorageService which grants me access to the privateStorage, but I am not entirely certain how to navigate into the respective cache directory, without checking for the Operating System first and then manually navigating to it.

And according to the CacheService documentation it only grants in access to an inmemory cache which unfortunately doesn't satisfy the requirements.

Could someone be so kind and point me to the right direction? I Really wouldn't want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant