app-cleaner.sh now moves app data to trash using a single osascript operation
This commit is contained in:
Sun Knudsen 2020-12-30 10:42:27 -05:00
parent 00cd60362d
commit 3617ab011d
No known key found for this signature in database
GPG Key ID: 1FA767862BBD1305
2 changed files with 2 additions and 3 deletions

View File

@ -114,8 +114,7 @@ read -r answer
if [ "$answer" = "y" ]; then if [ "$answer" = "y" ]; then
printf "%s\n" "Moving app data to trash..." printf "%s\n" "Moving app data to trash..."
sleep 1 sleep 1
for path in "${paths[@]}"; do posixFiles=$(printf ", POSIX file \"%s\"" "${paths[@]}" | awk '{print substr($0,3)}')
osascript -e "tell application \"Finder\" to delete POSIX file \"$path\"" > /dev/null osascript -e "tell application \"Finder\" to delete { $posixFiles }" > /dev/null
done
printf "%s\n" "Done" printf "%s\n" "Done"
fi fi