@@ -442,6 +442,7 @@ private static void deleteRecursive(File fileOrDirectory) throws IOException {
442442 * @param promise JS promise
443443 */
444444 static void mkdir (String path , Promise promise ) {
445+ path = ReactNativeBlobUtilUtils .normalizePath (path );
445446 File dest = new File (path );
446447 if (dest .exists ()) {
447448 promise .reject ("EEXIST" , (dest .isDirectory () ? "Folder" : "File" ) + " '" + path + "' already exists" );
@@ -469,6 +470,7 @@ static void mkdir(String path, Promise promise) {
469470 */
470471 static void cp (String path , String dest , Callback callback ) {
471472 path = ReactNativeBlobUtilUtils .normalizePath (path );
473+ dest = ReactNativeBlobUtilUtils .normalizePath (dest );
472474 InputStream in = null ;
473475 OutputStream out = null ;
474476 String message = "" ;
@@ -525,6 +527,8 @@ static void cp(String path, String dest, Callback callback) {
525527 * @param callback JS context callback
526528 */
527529 static void mv (String path , String dest , Callback callback ) {
530+ path = ReactNativeBlobUtilUtils .normalizePath (path );
531+ dest = ReactNativeBlobUtilUtils .normalizePath (dest );
528532 File src = new File (path );
529533 if (!src .exists ()) {
530534 callback .invoke ("Source file at path `" + path + "` does not exist" );
@@ -628,6 +632,7 @@ static void ls(String path, Promise promise) {
628632 static void slice (String path , String dest , int start , int end , String encode , Promise promise ) {
629633 try {
630634 path = ReactNativeBlobUtilUtils .normalizePath (path );
635+ dest = ReactNativeBlobUtilUtils .normalizePath (dest );
631636 File source = new File (path );
632637 if (source .isDirectory ()) {
633638 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
883888 */
884889 static void createFileASCII (String path , ReadableArray data , Promise promise ) {
885890 try {
891+ path = ReactNativeBlobUtilUtils .normalizePath (path );
886892 File dest = new File (path );
887893 boolean created = dest .createNewFile ();
888894 if (!created ) {
0 commit comments