From d951a1dbdde69cdb53e0e408ee4e0ab418780144 Mon Sep 17 00:00:00 2001 From: Helium314 Date: Mon, 2 Jun 2025 17:36:06 +0200 Subject: [PATCH] don't try to back up directories matching the file name patterns fixes #1653 --- .../keyboard/settings/preferences/BackupRestorePreference.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)