|
@@ -344,7 +344,6 @@ public class RNFetchBlobFS {
|
344
|
344
|
try {
|
345
|
345
|
stream.write(chunk);
|
346
|
346
|
callback.invoke();
|
347
|
|
- chunk = null;
|
348
|
347
|
} catch (Exception e) {
|
349
|
348
|
callback.invoke(e.getLocalizedMessage());
|
350
|
349
|
}
|
|
@@ -431,8 +430,7 @@ public class RNFetchBlobFS {
|
431
|
430
|
|
432
|
431
|
try {
|
433
|
432
|
|
434
|
|
- String destFolder = new File(dest).getPath();
|
435
|
|
- if(!new File(path).exists()) {
|
|
433
|
+ if(!isPathExists(path)) {
|
436
|
434
|
callback.invoke("cp error: source file at path`" + path + "` not exists");
|
437
|
435
|
return;
|
438
|
436
|
}
|
|
@@ -490,7 +488,6 @@ public class RNFetchBlobFS {
|
490
|
488
|
try {
|
491
|
489
|
String filename = path.replace(assetPrefix, "");
|
492
|
490
|
AssetFileDescriptor fd = RNFetchBlob.RCTContext.getAssets().openFd(filename);
|
493
|
|
- // TODO : handle asset folder
|
494
|
491
|
callback.invoke(true, false);
|
495
|
492
|
} catch (IOException e) {
|
496
|
493
|
callback.invoke(false, false);
|
|
@@ -512,14 +509,13 @@ public class RNFetchBlobFS {
|
512
|
509
|
static void ls(String path, Callback callback) {
|
513
|
510
|
path = normalizePath(path);
|
514
|
511
|
File src = new File(path);
|
515
|
|
- // TODO : handle asset folder
|
516
|
|
- if(!src.exists() || !src.isDirectory()) {
|
|
512
|
+ if (!src.exists() || !src.isDirectory()) {
|
517
|
513
|
callback.invoke("ls error: failed to list path `" + path + "` for it is not exist or it is not a folder");
|
518
|
514
|
return;
|
519
|
515
|
}
|
520
|
|
- String [] files = new File(path).list();
|
|
516
|
+ String[] files = new File(path).list();
|
521
|
517
|
WritableArray arg = Arguments.createArray();
|
522
|
|
- for(String i : files) {
|
|
518
|
+ for (String i : files) {
|
523
|
519
|
arg.pushString(i);
|
524
|
520
|
}
|
525
|
521
|
callback.invoke(null, arg);
|
|
@@ -527,7 +523,7 @@ public class RNFetchBlobFS {
|
527
|
523
|
|
528
|
524
|
static void lstat(String path, final Callback callback) {
|
529
|
525
|
path = normalizePath(path);
|
530
|
|
- File src = new File(path);
|
|
526
|
+
|
531
|
527
|
new AsyncTask<String, Integer, Integer>() {
|
532
|
528
|
@Override
|
533
|
529
|
protected Integer doInBackground(String ...args) {
|