diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index 3a7fcc181..7822da75f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -66,7 +66,8 @@ class MediaFetcher(val context: Context) { val shouldShowHidden = config.shouldShowHidden val excludedPaths = config.excludedFolders val includedPaths = config.includedFolders - folders.filter { it.shouldFolderBeVisible(excludedPaths, includedPaths, shouldShowHidden, context) }.toMutableList() as ArrayList + folders.distinctBy { it.getDistinctPath() } + .filter { it.shouldFolderBeVisible(excludedPaths, includedPaths, shouldShowHidden, context) }.toMutableList() as ArrayList } catch (e: Exception) { ArrayList() } @@ -190,7 +191,7 @@ class MediaFetcher(val context: Context) { addFolder(foldersToScan, it) } - return foldersToScan.distinctBy { it.getDistinctPath() }.toMutableSet() as LinkedHashSet + return foldersToScan.toMutableSet() as LinkedHashSet } private fun addFolder(curFolders: HashSet, folder: String) {