Refresh bundled workspace data on startup
This commit is contained in:
@@ -29,6 +29,34 @@ sync_missing_dir_entries() {
|
||||
done
|
||||
}
|
||||
|
||||
refresh_workspace_builtin_entries() {
|
||||
src_dir="$1"
|
||||
dst_dir="$2"
|
||||
|
||||
mkdir -p "$dst_dir"
|
||||
|
||||
for rel_path in \
|
||||
brands \
|
||||
misc \
|
||||
CHANGELOG.md \
|
||||
CHANGELOG_en.md \
|
||||
LICENSE.txt
|
||||
do
|
||||
src_entry="$src_dir/$rel_path"
|
||||
dst_entry="$dst_dir/$rel_path"
|
||||
|
||||
[ -e "$src_entry" ] || continue
|
||||
|
||||
rm -rf "$dst_entry"
|
||||
mkdir -p "$(dirname "$dst_entry")"
|
||||
cp -a "$src_entry" "$dst_entry"
|
||||
done
|
||||
|
||||
if [ -d "$src_dir/local" ]; then
|
||||
sync_missing_dir_entries "$src_dir/local" "$dst_dir/local"
|
||||
fi
|
||||
}
|
||||
|
||||
migrate_legacy_manual_catalog() {
|
||||
legacy_dir="$DATA_ROOT/workspace/brands/local"
|
||||
target_dir="$DATA_ROOT/workspace/local"
|
||||
@@ -69,7 +97,9 @@ init_path() {
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -d "$src_path" ]; then
|
||||
if [ "$rel_path" = "workspace" ] && [ -d "$src_path" ] && [ ! -L "$src_path" ]; then
|
||||
refresh_workspace_builtin_entries "$src_path" "$dst_path"
|
||||
elif [ -d "$src_path" ]; then
|
||||
if [ ! -e "$dst_path" ] && [ ! -L "$dst_path" ]; then
|
||||
mkdir -p "$(dirname "$dst_path")"
|
||||
cp -a "$src_path" "$dst_path"
|
||||
|
||||
Reference in New Issue
Block a user