fix Karabiner setup
This commit is contained in:
@@ -136,6 +136,15 @@ replace_dir() {
|
|||||||
link_dotfile() {
|
link_dotfile() {
|
||||||
source_path=$1
|
source_path=$1
|
||||||
target_path=$2
|
target_path=$2
|
||||||
|
resolved_source_path=$(cd "$(dirname "$source_path")" && pwd)/$(basename "$source_path")
|
||||||
|
target_parent=$(dirname "$target_path")
|
||||||
|
resolved_target_parent=$(cd "$target_parent" 2>/dev/null && pwd || printf '%s' "$target_parent")
|
||||||
|
resolved_target_path=$resolved_target_parent/$(basename "$target_path")
|
||||||
|
|
||||||
|
if [ "$resolved_source_path" = "$resolved_target_path" ]; then
|
||||||
|
skip "$target_path resolves to the source path; refusing to create a self-referential symlink."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -L "$target_path" ]; then
|
if [ -L "$target_path" ]; then
|
||||||
current_target=$(readlink "$target_path")
|
current_target=$(readlink "$target_path")
|
||||||
|
|||||||
Reference in New Issue
Block a user