diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index c2d883404..790214824 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -106,10 +106,12 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va private fun removeExcludedFolders(paths: MutableList) { val excludedPaths = config.excludedFolders - val ignorePaths = paths.filter { excludedPaths.contains(it) } + val ignorePaths = paths.filter { isThisOrParentExcluded(it, excludedPaths) } paths.removeAll(ignorePaths) } + private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet) = excludedPaths.any { path.startsWith(it) } + private fun movePinnedToFront(dirs: ArrayList): ArrayList { val foundFolders = ArrayList() val pinnedFolders = config.pinnedFolders