diff --git a/tools/init_runtime_data.sh b/tools/init_runtime_data.sh index 1e124b4..cb15a80 100644 --- a/tools/init_runtime_data.sh +++ b/tools/init_runtime_data.sh @@ -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 - refresh_workspace_builtin_entries "$src_path" "$dst_path" + 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")"