Skip to content

Commit 018eb13

Browse files
committed
fix(android): unlink non-empty directories
Closes #21
1 parent 2646386 commit 018eb13

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

android/src/main/java/com/alpha0010/fs/FileAccessModule.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ class FileAccessModule(reactContext: ReactApplicationContext) : ReactContextBase
380380
@ReactMethod
381381
fun unlink(path: String, promise: Promise) {
382382
try {
383-
if (parsePathToFile(path).delete()) {
383+
val file = parsePathToFile(path)
384+
if (file.exists() && file.deleteRecursively()) {
384385
promise.resolve(null)
385386
} else {
386387
promise.reject("ERR", "Failed to unlink '$path'.")

0 commit comments

Comments
 (0)