fix: listBackupFiles 跳过 Java 空数组回落 root shell
FUSE 文件系统可能将 EPERM 表现为空数组而非 null, 导致 listBackupFiles 提前返回 [] 从未执行 ls -1 回落。 改为仅当 Java 返回非空结果才提前返回,空数组继续走 root shell。
This commit is contained in:
Binary file not shown.
@@ -460,7 +460,13 @@ object BackupOperation {
|
||||
*/
|
||||
internal suspend fun listBackupFiles(dir: File): List<String>? {
|
||||
try {
|
||||
return dir.listFiles()?.map { it.name }
|
||||
val javaFiles = dir.listFiles()
|
||||
if (javaFiles != null) {
|
||||
val names = javaFiles.map { it.name }
|
||||
if (names.isNotEmpty()) return names
|
||||
// Java returned empty — FUSE may report EPERM as empty array
|
||||
// Fall through to root shell ls for definitive answer
|
||||
}
|
||||
} catch (_: Exception) { /* fall through */ }
|
||||
try {
|
||||
val result = RootShell.exec("ls -1 '${dir.absolutePath.shellEscape()}' 2>/dev/null")
|
||||
|
||||
Reference in New Issue
Block a user