Ver código fonte

严格要求路径

詹子聪 5 anos atrás
pai
commit
cbc650bae1

+ 4 - 4
app/src/main/java/com/miekir/ocr/ui/OperationPresenter.java

@@ -124,17 +124,17 @@ public class OperationPresenter extends BasePresenter<IOperationView> {
                             File rawFile = new File(rawFilePath);
                             if (file != compressedFile) {
                                 file.delete();
-                                if (!rawFilePath.contains("cache")) {
+                                if (!rawFilePath.contains("/cache/")) {
                                     compressedFile.delete();
                                 } else {
-                                    rawFile.delete();
+                                    boolean success = rawFile.delete();
                                     MediaScannerConnection.scanFile(context, new String[] { compressedFile.getAbsolutePath() }, new String[] { "image/jpeg" }, null);
                                 }
                             } else {
-                                if (!rawFilePath.contains("cache")) {
+                                if (!rawFilePath.contains("/cache/")) {
                                     file.delete();
                                 } else {
-                                    rawFile.delete();
+                                    boolean success = rawFile.delete();
                                     MediaScannerConnection.scanFile(context, new String[] { file.getAbsolutePath() }, new String[] { "image/jpeg" }, null);
                                 }
                             }