Preserve synced workspace data on startup
This commit is contained in:
@@ -57,6 +57,10 @@ refresh_workspace_builtin_entries() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
workspace_has_sync_metadata() {
|
||||||
|
[ -f "$DATA_ROOT/state/sync_status.json" ]
|
||||||
|
}
|
||||||
|
|
||||||
migrate_legacy_manual_catalog() {
|
migrate_legacy_manual_catalog() {
|
||||||
legacy_dir="$DATA_ROOT/workspace/brands/local"
|
legacy_dir="$DATA_ROOT/workspace/brands/local"
|
||||||
target_dir="$DATA_ROOT/workspace/local"
|
target_dir="$DATA_ROOT/workspace/local"
|
||||||
@@ -98,7 +102,14 @@ init_path() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$rel_path" = "workspace" ] && [ -d "$src_path" ] && [ ! -L "$src_path" ]; then
|
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
|
elif [ -d "$src_path" ]; then
|
||||||
if [ ! -e "$dst_path" ] && [ ! -L "$dst_path" ]; then
|
if [ ! -e "$dst_path" ] && [ ! -L "$dst_path" ]; then
|
||||||
mkdir -p "$(dirname "$dst_path")"
|
mkdir -p "$(dirname "$dst_path")"
|
||||||
|
|||||||
Reference in New Issue
Block a user