From 480093530c79cbd1aa80b01385b539f4e9489728 Mon Sep 17 00:00:00 2001 From: adamburnett Date: Mon, 16 Jul 2018 10:23:15 -0600 Subject: [PATCH] Added check for failing to create the output directory --- android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java index 6eba4f15a..7b4dfdb72 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java @@ -604,7 +604,11 @@ static void mv(String path, String dest, Callback callback) { File dir = new File(dest); if (!dir.exists()) { - dir.mkdirs(); + if (!dir.mkdirs()) + { + callback.invoke("Output directory creation failed."); + return; + } } try { @@ -622,7 +626,7 @@ static void mv(String path, String dest, Callback callback) { src.delete(); //remove original file } catch (FileNotFoundException exception) { - callback.invoke(exception.toString()); + callback.invoke("Source file not found."); return; } catch (Exception e) { callback.invoke(e.toString());