Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 89d1f68

Browse files
committed
Add exception handling when file does not removed correctly #236
1 parent 90767ff commit 89d1f68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,16 @@ static void unlink(String path, Callback callback) {
397397
}
398398
}
399399

400-
static void deleteRecursive(File fileOrDirectory) {
400+
static void deleteRecursive(File fileOrDirectory) throws Exception {
401401

402402
if (fileOrDirectory.isDirectory()) {
403403
for (File child : fileOrDirectory.listFiles()) {
404404
deleteRecursive(child);
405405
}
406406
}
407-
fileOrDirectory.delete();
407+
boolean removed = fileOrDirectory.delete();
408+
if(!removed)
409+
throw new Exception("file at path " + fileOrDirectory.getAbsolutePath() + " could not be removed.");
408410
}
409411

410412
/**

0 commit comments

Comments
 (0)