add some more conditions to folder visibility checking

This commit is contained in:
tibbi 2017-05-21 12:58:07 +02:00
parent 387c063376
commit d4a8560d2c

View file

@ -70,7 +70,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
} }
private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet<String>): Boolean { private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet<String>): Boolean {
return isThisOrParentExcluded(path, excludedPaths) || (!config.shouldShowHidden && File(path).containsNoMedia()) val file = File(path)
return isThisOrParentExcluded(path, excludedPaths) || (!config.shouldShowHidden && file.isDirectory &&
file.canonicalFile == file.absoluteFile && file.containsNoMedia())
} }
private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet<String>) = excludedPaths.any { path.startsWith(it) } private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet<String>) = excludedPaths.any { path.startsWith(it) }