@ -52,7 +52,7 @@ object BookHelp {
App.db.bookDao().all.forEach {
bookFolderNames.add(it.getFolderName())
}
val file = FileUtils.getDirFile(downloadDir, cacheFolderName)
val file = FileUtils.getFile(downloadDir, cacheFolderName)
file.listFiles()?.forEach { bookFile ->
if (!bookFolderNames.contains(bookFile.name)) {
FileUtils.deleteFile(bookFile.absolutePath)
@ -142,7 +142,7 @@ class CrashHandler : Thread.UncaughtExceptionHandler {
val time = format.format(Date())
val fileName = "crash-$time-$timestamp.log"
mContext?.externalCacheDir?.let { rootFile ->
FileUtils.getDirFile(rootFile, "crash").listFiles()?.forEach {
FileUtils.getFile(rootFile, "crash").listFiles()?.forEach {
if (it.lastModified() < System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7)) {
it.delete()
@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit
object Backup {
val backupPath: String by lazy {
FileUtils.getDirFile(App.INSTANCE.filesDir, "backup").absolutePath
FileUtils.getFile(App.INSTANCE.filesDir, "backup").absolutePath
val backupFileNames by lazy {
@ -54,11 +54,6 @@ object FileUtils {
return File(filePath)
fun getDirFile(root: File, vararg subDirs: String): File {
val filePath = getPath(root = root, *subDirs)
fun getPath(root: File, vararg subDirFiles: String): String {
val path = StringBuilder(root.absolutePath)
subDirFiles.forEach {