/link.sh Secret
Last active
September 30, 2024 13:43
`ln -s` inside WSL *does not* create Windows symbolic links; they are only made with mklink in cmd.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
variant="${1:-retail}" | |
wowdir="/mnt/c/World of Warcraft/_${variant}_/Interface/Addons" | |
if ! wowdirWIN=$(wslpath -w "${wowdir}") ; then | |
echo "failed to find wowdir for ${variant}" | |
exit 1 | |
fi | |
# TODO: magic filters to only link addons that apply to the current variant? | |
mklink () { | |
if [ ! $# -eq 2 ] | |
then | |
echo "mklink requires two arguments" | |
exit 1 | |
fi | |
# mklink /D Destination Source | |
# echo "cmd.exe /c \"mklink /D \"$1\" \"$2\"\"" | |
cmd.exe /c "mklink /D "$1" "$2"" | |
} | |
for i in ./* ; do | |
if [ -d "$i" ]; then | |
addon=$(basename "$i") | |
if [ -e "$wowdir/$addon" ] ; then | |
echo "$addon already exists" | |
else | |
mklink "$wowdirWIN\\$addon" "$(wslpath -aw $addon)" | |
#exit 0 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, this was still more appealing to me than writing a batch file.