Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 039aa6c9 authored by tibbi's avatar tibbi
Browse files

add an extra filesize check before deleting it

parent ef07a324
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ fun BaseSimpleActivity.deleteFile(fileDirItem: FileDirItem, allowDeleteFolder: B
fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder: Boolean = false, callback: ((wasSuccess: Boolean) -> Unit)? = null) {
    val path = fileDirItem.path
    val file = File(path)
    var fileDeleted = !path.startsWith(OTG_PATH) && (!file.exists() || file.delete())
    var fileDeleted = !path.startsWith(OTG_PATH) && (!file.exists() && file.length() == 0L || file.delete())
    if (fileDeleted) {
        rescanDeletedPath(path) {
            callback?.invoke(true)