Skip to content

Commit

Permalink
Added check for failing to create the output directory
Browse files Browse the repository at this point in the history
  • Loading branch information
adamburnett committed Jul 16, 2018
1 parent 5837361 commit 4800935
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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());
Expand Down

0 comments on commit 4800935

Please sign in to comment.