Page 1 of 1

[SUG] Move cache directory to /Android/data

Posted: 2011-09-19, 23:11 UTC
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");

Posted: 2011-09-20, 15:47 UTC
by ghisler(Author)
Thanks for the info, I didn't know that. I will check whether I can support it.