mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
be more agressive at deleting corrupt cached files
This commit is contained in:
parent
ff6de731c9
commit
a6057f7fe4
1 changed files with 6 additions and 4 deletions
|
@ -611,12 +611,14 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
val newMedia = it
|
||||
try {
|
||||
gotMedia(newMedia, false)
|
||||
oldMedia.filter { !newMedia.contains(it) }.mapNotNull { it as? Medium }.forEach {
|
||||
if (!getDoesFilePathExist(it.path)) {
|
||||
mediaDB.deleteMediumPath(it.path)
|
||||
} else if (mPath == FAVORITES) {
|
||||
|
||||
val newPaths = newMedia.mapNotNull { it as? Medium }.map { it.path }
|
||||
oldMedia.mapNotNull { it as? Medium }.filter { !newPaths.contains(it.path) }.forEach {
|
||||
if (mPath == FAVORITES && getDoesFilePathExist(it.path)) {
|
||||
favoritesDB.deleteFavoritePath(it.path)
|
||||
mediaDB.updateFavorite(it.path, false)
|
||||
} else {
|
||||
mediaDB.deleteMediumPath(it.path)
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
|
Loading…
Reference in a new issue