Skip to content

Instantly share code, notes, and snippets.

@shanestillwell
Created April 15, 2013 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanestillwell/5390980 to your computer and use it in GitHub Desktop.
Save shanestillwell/5390980 to your computer and use it in GitHub Desktop.
zapImageCache = function() {
var appDataDir, cacheDir, dir, externalRoot;
if (Ti.Filesystem.isExternalStoragePresent()) {
appDataDir = Ti.Filesystem.getFile('appdata://').nativePath;
externalRoot = appDataDir.substring(0, appDataDir.lastIndexOf('/'));
cacheDir = "" + externalRoot + "/Android/data/" + Ti.App.id + "/cache/_tmp/remote-cache";
dir = Ti.Filesystem.getFile(cacheDir);
} else {
dir = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, '_tmp', 'remote-cache');
}
if (dir.exists()) {
dir.deleteDirectory(true);
}
return dir.createDirectory();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment