Pebble: also delete other files from cache when deleting .pbw
This commit is contained in:
parent
f697906572
commit
24c51deaf9
|
@ -212,16 +212,25 @@ public class AppManagerActivity extends GBActivity {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.appmanager_health_deactivate:
|
case R.id.appmanager_health_deactivate:
|
||||||
case R.id.appmanager_app_delete_cache:
|
case R.id.appmanager_app_delete_cache:
|
||||||
File cachedFile = null;
|
|
||||||
boolean deleteSuccess = true;
|
|
||||||
|
String baseName;
|
||||||
try {
|
try {
|
||||||
cachedFile = new File(FileUtils.getExternalFilesDir().getPath() + "/pbw-cache/" + selectedApp.getUUID() + ".pbw");
|
baseName = FileUtils.getExternalFilesDir().getPath() + "/pbw-cache/" + selectedApp.getUUID();
|
||||||
deleteSuccess = cachedFile.delete();
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.warn("could not get external dir while trying to access pbw cache.");
|
LOG.warn("could not get external dir while trying to access pbw cache.");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
if (!deleteSuccess) {
|
|
||||||
LOG.warn("could not delete file from pbw cache: " + cachedFile.toString());
|
String[] suffixToDelete = new String[]{".pbw", ".json", "_config.js"};
|
||||||
|
|
||||||
|
for (String suffix : suffixToDelete) {
|
||||||
|
File fileToDelete = new File(baseName + suffix);
|
||||||
|
if (!fileToDelete.delete()) {
|
||||||
|
LOG.warn("could not delete file from pbw cache: " + fileToDelete.toString());
|
||||||
|
} else {
|
||||||
|
LOG.info("deleted file: " + fileToDelete.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
case R.id.appmanager_app_delete:
|
case R.id.appmanager_app_delete:
|
||||||
|
|
Loading…
Reference in New Issue