@@ -442,6 +442,7 @@ private static void deleteRecursive(File fileOrDirectory) throws IOException {
442
442
* @param promise JS promise
443
443
*/
444
444
static void mkdir (String path , Promise promise ) {
445
+ path = ReactNativeBlobUtilUtils .normalizePath (path );
445
446
File dest = new File (path );
446
447
if (dest .exists ()) {
447
448
promise .reject ("EEXIST" , (dest .isDirectory () ? "Folder" : "File" ) + " '" + path + "' already exists" );
@@ -469,6 +470,7 @@ static void mkdir(String path, Promise promise) {
469
470
*/
470
471
static void cp (String path , String dest , Callback callback ) {
471
472
path = ReactNativeBlobUtilUtils .normalizePath (path );
473
+ dest = ReactNativeBlobUtilUtils .normalizePath (dest );
472
474
InputStream in = null ;
473
475
OutputStream out = null ;
474
476
String message = "" ;
@@ -525,6 +527,8 @@ static void cp(String path, String dest, Callback callback) {
525
527
* @param callback JS context callback
526
528
*/
527
529
static void mv (String path , String dest , Callback callback ) {
530
+ path = ReactNativeBlobUtilUtils .normalizePath (path );
531
+ dest = ReactNativeBlobUtilUtils .normalizePath (dest );
528
532
File src = new File (path );
529
533
if (!src .exists ()) {
530
534
callback .invoke ("Source file at path `" + path + "` does not exist" );
@@ -628,6 +632,7 @@ static void ls(String path, Promise promise) {
628
632
static void slice (String path , String dest , int start , int end , String encode , Promise promise ) {
629
633
try {
630
634
path = ReactNativeBlobUtilUtils .normalizePath (path );
635
+ dest = ReactNativeBlobUtilUtils .normalizePath (dest );
631
636
File source = new File (path );
632
637
if (source .isDirectory ()) {
633
638
promise .reject ("EISDIR" , "Expecting a file but '" + path + "' is a directory" );
@@ -883,6 +888,7 @@ static void createFile(String path, String data, String encoding, Promise promis
883
888
*/
884
889
static void createFileASCII (String path , ReadableArray data , Promise promise ) {
885
890
try {
891
+ path = ReactNativeBlobUtilUtils .normalizePath (path );
886
892
File dest = new File (path );
887
893
boolean created = dest .createNewFile ();
888
894
if (!created ) {
0 commit comments