forked from jpadilla/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsymlinks.sh
More file actions
executable file
·32 lines (27 loc) · 856 Bytes
/
symlinks.sh
File metadata and controls
executable file
·32 lines (27 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
function symlinkFilesTo() {
echo "$1" | while read -r sourcePath; do
cleanPath=$(dirname $(echo "$sourcePath" | cut -d/ -f6-))
filePath=$(basename "${sourcePath%.*}")
if [ "$cleanPath" == "." ]; then
dst="$2/$filePath"
else
dst="$2/$cleanPath/$filePath"
fi
echo "${sourcePath} => ${dst}"
ln -sfn "${sourcePath}" "${dst}"
done
}
# Home files
echo "--> home symlinks.."
homeFiles=$(find -H $(pwd) -maxdepth 2 -name '*.symlink' -not -path '*vscode*')
symlinkFilesTo "$homeFiles" "$HOME"
# vscode
echo "--> VSCode symlinks..."
mkdir -p "$HOME/Library/Application Support/Code/User/snippets"
vscodeFiles=$(find -H "$(pwd)/vscode" -maxdepth 2 -name '*.symlink')
symlinkFilesTo "$vscodeFiles" "$HOME/Library/Application Support/Code/User"
# Done
echo "--> Done!"
unset symlinkFilesTo
source ~/.profile