From 6098f46d0835664bc5343a277877885ea95a5ca6 Mon Sep 17 00:00:00 2001 From: macdonst Date: Thu, 29 Sep 2011 23:09:44 -0400 Subject: [PATCH] When you use the File API to remove a file need to check to see if we need to delete a row from the content store --- framework/src/com/phonegap/FileUtils.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/src/com/phonegap/FileUtils.java b/framework/src/com/phonegap/FileUtils.java index 29b1dd3c..17a94780 100755 --- a/framework/src/com/phonegap/FileUtils.java +++ b/framework/src/com/phonegap/FileUtils.java @@ -158,6 +158,7 @@ public class FileUtils extends Plugin { success = remove(args.getString(0)); if (success) { + notifyDelete(args.getString(0)); return new PluginResult(status); } else { JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR); @@ -221,6 +222,17 @@ public class FileUtils extends Plugin { } /** + * Need to check to see if we need to clean up the content store + * + * @param filePath the path to check + */ + private void notifyDelete(String filePath) { + int result = this.ctx.getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, + MediaStore.Images.Media.DATA + " = ?", + new String[] {filePath}); + } + + /** * Allows the user to look up the Entry for a file or directory referred to by a local URI. * * @param url of the file/directory to look up