diff --git a/app/src/main/java/helium314/keyboard/settings/preferences/BackupRestorePreference.kt b/app/src/main/java/helium314/keyboard/settings/preferences/BackupRestorePreference.kt index e156a5d21..159d79671 100644 --- a/app/src/main/java/helium314/keyboard/settings/preferences/BackupRestorePreference.kt +++ b/app/src/main/java/helium314/keyboard/settings/preferences/BackupRestorePreference.kt @@ -67,7 +67,7 @@ fun BackupRestorePreference(setting: Setting) { val files = mutableListOf() filesDir.walk().forEach { file -> val path = file.path.replace(filesPath, "") - if (backupFilePatterns.any { path.matches(it) }) + if (file.isFile && backupFilePatterns.any { path.matches(it) }) files.add(file) } val protectedFilesDir = DeviceProtectedUtils.getFilesDir(ctx) @@ -75,7 +75,7 @@ fun BackupRestorePreference(setting: Setting) { val protectedFiles = mutableListOf() protectedFilesDir.walk().forEach { file -> val path = file.path.replace(protectedFilesPath, "") - if (backupFilePatterns.any { path.matches(it) }) + if (file.isFile && backupFilePatterns.any { path.matches(it) }) protectedFiles.add(file) } val wait = CountDownLatch(1)