From d78b9a87d2b359f62ef75c04c2fdb85899e34afc Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Nov 2018 22:18:15 +0100 Subject: [PATCH] exclude the data folder by default again --- .../simplemobiletools/gallery/pro/helpers/Config.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 8d5bc649d..1c854e81a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -117,9 +117,17 @@ class Config(context: Context) : BaseConfig(context) { } var excludedFolders: MutableSet - get() = prefs.getStringSet(EXCLUDED_FOLDERS, HashSet()) + get() = prefs.getStringSet(EXCLUDED_FOLDERS, getDataFolder()) set(excludedFolders) = prefs.edit().remove(EXCLUDED_FOLDERS).putStringSet(EXCLUDED_FOLDERS, excludedFolders).apply() + private fun getDataFolder(): Set { + val folders = HashSet() + val dataFolder = context.externalCacheDir?.parentFile?.parent?.trimEnd('/') ?: "" + if (dataFolder.endsWith("data")) + folders.add(dataFolder) + return folders + } + fun addIncludedFolder(path: String) { val currIncludedFolders = HashSet(includedFolders) currIncludedFolders.add(path)