Sfoglia il codice sorgente

Merge pull request #117 from ihavenoface5/FileMoving

Added check for failing to create the output directory
Travis Nuttall 5 anni fa
parent
commit
f1b86940b8
No account linked to committer's email address

+ 6
- 2
android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java Vedi File

@@ -604,7 +604,11 @@ class RNFetchBlobFS {
604 604
         File dir = new File(dest);
605 605
         if (!dir.exists())
606 606
         {
607
-            dir.mkdirs();
607
+            if (!dir.mkdirs())
608
+            {
609
+                callback.invoke("Output directory creation failed.");
610
+                return;
611
+            }
608 612
         }
609 613
 
610 614
         try {
@@ -622,7 +626,7 @@ class RNFetchBlobFS {
622 626
 
623 627
             src.delete(); //remove original file
624 628
         } catch (FileNotFoundException exception) {
625
-            callback.invoke(exception.toString());
629
+            callback.invoke("Source file not found.");
626 630
             return;
627 631
         } catch (Exception e) {
628 632
             callback.invoke(e.toString());