fix(setup): make copy item work with FORCE and IGNORE_EXISTING
This commit is contained in:
@@ -164,6 +164,14 @@ create_symlink() {
|
|||||||
ln -s "$src" "$dst"
|
ln -s "$src" "$dst"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_path() {
|
||||||
|
local target
|
||||||
|
target="$1"
|
||||||
|
|
||||||
|
echo "Trashing item: $target"
|
||||||
|
gio trash "$target"
|
||||||
|
}
|
||||||
|
|
||||||
copy_item() {
|
copy_item() {
|
||||||
local src dst dst_parent
|
local src dst dst_parent
|
||||||
|
|
||||||
@@ -195,9 +203,15 @@ copy_item() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test -e "$dst"; then
|
if test -e "$dst"; then
|
||||||
|
if $FORCE; then
|
||||||
|
remove_path "$dst"
|
||||||
|
elif $IGNORE_EXISTING; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
error "path already exists:"
|
error "path already exists:"
|
||||||
error "${dst}"
|
error "${dst}"
|
||||||
return
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Copying item: from $src to ${dst_parent}/"
|
echo "Copying item: from $src to ${dst_parent}/"
|
||||||
|
|||||||
Reference in New Issue
Block a user