[SUG] Move cache directory to /Android/data

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
ltm
Junior Member
Junior Member
Posts: 5
Joined: 2011-09-19, 20:21 UTC

[SUG] Move cache directory to /Android/data

Post by *ltm »

It looks like the app keeps a cache directory for thumbnails in [face=courier]/.TotalCommander[/face] on the external storage volume. According to the documentation for Environment.getExternalStorageDirectory(), applications shouldn't use the top-level directory:
Applications should not directly use this top-level directory, in order to avoid polluting the user's root namespace.
The Dev Guide recommends using Context.getExternalCacheDir(), which would be equivalent to [face=courier]/Android/data/com.ghisler.android.TotalCommander/cache[/face]. Since Context.getExternalCacheDir() was introduced in API Level 8, you may want to build the path manually:

Code: Select all

File externalCacheDir = new File(new File(new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"), context.getPackageName()), "cache");
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for the info, I didn't know that. I will check whether I can support it.
Author of Total Commander
https://www.ghisler.com
Post Reply