From 07e15db08afb48b7385719a13d474010507a74d2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 17 Mar 2017 20:23:46 +0100 Subject: [PATCH] filter out symbolic link folders earlier --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 5 +---- .../com/simplemobiletools/gallery/extensions/context.kt | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) 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 a58a9cf34..790214824 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -61,10 +61,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va media.sort() val directories = groupDirectories(media) - val dirs = ArrayList(directories.values.filter { - val file = File(it.path) - file.exists() && file.canonicalFile == file.absoluteFile // filter out symbolic links too - }) + val dirs = ArrayList(directories.values.filter { File(it.path).exists() }) Directory.sorting = config.directorySorting dirs.sort() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index c446567b2..ffe7b3f4b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -75,7 +75,8 @@ fun Context.getParents(): ArrayList { } parentsSet.filterTo(parents, { - if (File(it).isDirectory) { + val file = File(it) + if (file.isDirectory && file.canonicalFile == file.absoluteFile) { // filter out symbolic links too if (!config.showHiddenFolders) { isFolderVisible(it, noMediaFolders) } else