package com.base.filerecoveryrecyclebin.activity.recyclebin

import com.base.filerecoveryrecyclebin.help.BaseApplication
import java.io.File

object RecycleBinFileEx {

    fun getRecycleBinDir(): File {
        val file = BaseApplication.context.filesDir
        val recycleBinDir = File(file, "RecycleBin")
        if (!recycleBinDir.exists()) {
            recycleBinDir.mkdirs()
        }
        return recycleBinDir
    }

    fun findRecycleBinFile(namePath: String): File? {
        return getRecycleBinDir().listFiles()?.find { it.name.contains(namePath) }
    }

    fun findRecycleBinJsonFile(namePath: String): File? {
        return getRecycleBinDir().listFiles()?.find { it.name.contains(".$namePath.bin") }
    }
}