Fixed mkuserdirs not working properly

This commit is contained in:
斟酌 鵬兄 2022-09-10 22:26:51 +09:00
parent ab7c656cf5
commit 100162f4b0

View File

@ -2,15 +2,28 @@
function mkuserdirs { function mkuserdirs {
local PROFILE PKG_DIR i local PKG_DIR i IFS=$'\n'
PROFILE=$( cygpath $USERPROFILE ) for i in $( reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" \
for i in $( ls $PROFILE | grep -o "^[A-Z][a-z]\+$" ); do | grep "^ [A-Za-z ]\+" \
ln -vs "$PROFILE/$i" $HOME/ | tr -d '\r' \
| sed -e "s/.\+REG_EXPAND_SZ[ ]\+//g"
); do
if [[ "$i" =~ .*"\\AppData\\".* ]]; then
continue
fi
if [[ "$i" =~ "%USERPROFILE".* ]]; then
i=$USERPROFILE${i/\%USERPROFILE\%/}
fi
ln -vs "$( cygpath "$i" )" $HOME/
done done
# Package Directory # Package Directory
PKG_DIR="$APPDATA/../Local/Packages" PKG_DIR=$( cygpath "$APPDATA/../Local/Packages" )
if [ -d "$PKG_DIR" ]; then if [ -d "$PKG_DIR" ]; then
ln -vs "$PKG_DIR" $HOME/ ln -vs "$PKG_DIR" $HOME/
fi fi
} }