From d4f81d343785002dbce3708b55e73b9c53d69235 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Apr 2018 14:32:21 +0200 Subject: [PATCH] use the more advanced way of checking if a file exists --- .../com/simplemobiletools/gallery/extensions/Context.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index 27fe78b8b..c82f1d3b4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -304,7 +304,7 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag }) as ArrayList callback(filteredMedia) - media.filter { !File(it.path).exists() }.forEach { + media.filter { !getDoesFilePathExist(it.path) }.forEach { mediumDao.deleteMediumPath(it.path) } }.start() @@ -312,7 +312,7 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag fun Context.removeInvalidDirectories(dirs: ArrayList? = null, directoryDao: DirectoryDao = galleryDB.DirectoryDao()) { val dirsToCheck = dirs ?: directoryDao.getAll() - dirsToCheck.filter { !File(it.path).exists() }.forEach { + dirsToCheck.filter { !getDoesFilePathExist(it.path) }.forEach { directoryDao.deleteDirPath(it.path) } }