mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 04:22:06 +08:00
refactor: Optimize backup file discovery in restore feature
- Replaced `mapfile` with a more robust `while` loop for backup file collection - Improved file validation during backup file discovery - Enhanced error handling and file selection process - Ensured only valid files are added to the backup files array
This commit is contained in:
parent
3f3d0a6533
commit
fd6872cb2d
@ -544,8 +544,11 @@ restore_feature() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# 使用find命令获取备份文件列表
|
||||
mapfile -t backup_files < <(find "$BACKUP_DIR" -name "*.backup_*" -type f 2>/dev/null | sort)
|
||||
# 使用 find 命令获取备份文件列表并存储到数组
|
||||
backup_files=()
|
||||
while IFS= read -r file; do
|
||||
[ -f "$file" ] && backup_files+=("$file")
|
||||
done < <(find "$BACKUP_DIR" -name "*.backup_*" -type f 2>/dev/null | sort)
|
||||
|
||||
# 检查是否找到备份文件
|
||||
if [ ${#backup_files[@]} -eq 0 ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user