Skip to content

Handle deletion of non-empty folders. #640

Description

@x-sheep

Currently, FileKit has a single delete() function that fails on Android when it tries to delete a non-empty folder. I've now added my own extension function that deletes the contents recursively, but this isn't ideal.

Ideally, this functionality is handled by FileKit itself, either explicitly or as part of the current delete() function. This is more fool-proof than having to write your own function, and can handle symlinks properly on each platform (unlink the symbol instead of destroying the folder it's referring to).

I'm using FileKit 0.15.0.

java.io.IOException: Deletion failed
	at kotlinx.io.files.FileSystemJvmKt$SystemFileSystem$1.delete(FileSystemJvm.kt:66)
	at io.github.vinceglb.filekit.PlatformFile_androidKt$delete$2.invokeSuspend(PlatformFile.android.kt:456)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions