Preserve synced workspace data on startup

This commit is contained in:
2026-04-24 10:57:35 +08:00
parent b1f0b4651a
commit 8754669d40
+11
View File
@@ -57,6 +57,10 @@ refresh_workspace_builtin_entries() {
fi
}
workspace_has_sync_metadata() {
[ -f "$DATA_ROOT/state/sync_status.json" ]
}
migrate_legacy_manual_catalog() {
legacy_dir="$DATA_ROOT/workspace/brands/local"
target_dir="$DATA_ROOT/workspace/local"
@@ -98,7 +102,14 @@ init_path() {
fi
if [ "$rel_path" = "workspace" ] && [ -d "$src_path" ] && [ ! -L "$src_path" ]; then
if [ ! -e "$dst_path" ] && [ ! -L "$dst_path" ]; then
mkdir -p "$(dirname "$dst_path")"
cp -a "$src_path" "$dst_path"
elif workspace_has_sync_metadata; then
sync_missing_dir_entries "$src_path/local" "$dst_path/local"
else
refresh_workspace_builtin_entries "$src_path" "$dst_path"
fi
elif [ -d "$src_path" ]; then
if [ ! -e "$dst_path" ] && [ ! -L "$dst_path" ]; then
mkdir -p "$(dirname "$dst_path")"