use the more advanced way of checking if a file exists

This commit is contained in:
tibbi 2018-04-24 14:32:21 +02:00
parent 85a0a69599
commit d4f81d3437
1 changed files with 2 additions and 2 deletions

View File

@ -304,7 +304,7 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
}) as ArrayList<Medium>
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<Directory>? = 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)
}
}