#!/bin/sh
#
# https://overflow.ducks.party/exchange/superuser.com/questions/618501/changing-an-applications-icon-from-the-terminal-osx

apps="Emacs"

for app in ${apps}; do
  new_icon="${DATAFILES_PATH-}/App Icons/${app}.icns"
  app_dir="/Applications/${app}.app"
  # make sure file exist and app installed
  if [ -f "${new_icon}" ] && [ -d "${app_dir}" ]; then
    cp "${new_icon}" "${app_dir}/Contents/Resources/${app}.icns"
    touch "${app_dir}"
    echo "Finished changing icon: ${app}"
  else
    echo "Icon files does not exist or ${app} is not installed"
  fi
done
