Tweak to XCode copy script

I just tweaked the final “Copy to the different plugin folders” script to speed up my debugging life a bit. Previously XCode would copy the files every time I wanted to run the debugger, even if I hadn’t made any changes. I added a test of the modification dates before the files are copied, which saves me some seconds of waiting in that case.

EDIT: added braces to make bash happier.

# This script takes the build product and copies it to the AU, VST, and RTAS folders, depending on 
# which plugin types you've built


# this looks inside the binary to detect which platforms are needed.. 
copyAU=`nm -g "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH" | grep -i 'AudioUnit' | wc -l`
copyVST=`nm -g "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH" | grep -i 'VSTPlugin' | wc -l`
copyRTAS=`nm -g "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH" | grep -i 'CProcess' | wc -l`

# get paths to executable and copies in order to check modification dates
RTAS=/Library/Application\ Support/Digidesign/Plug-Ins/$PRODUCT_NAME.dpm

if [[ $copyAU -gt 0 ]] && [[ $new_exe -nt $AU ]]; then
  echo "Copying to AudioUnit folder..."
  if [[ -d "$AU" ]]; then 
    rm -r "$AU"

  cp -r "$original" "$AU"
  sed -i "" -e 's/TDMwPTul/BNDLPTul/g' "$AU/Contents/PkgInfo"
  sed -i "" -e 's/TDMw/BNDL/g' "$AU/Contents/$INFOPLIST_FILE"

if [[ $copyVST -gt 0 ]] && [[ $new_exe -nt $VST ]]; then
  echo "Copying to VST folder..."
  if [[ -d "$VST" ]]; then 
    rm -r "$VST"

  cp -r "$original" "$VST"
  sed -i "" -e 's/TDMwPTul/BNDLPTul/g' "$VST/Contents/PkgInfo"
  sed -i "" -e 's/TDMw/BNDL/g' "$VST/Contents/$INFOPLIST_FILE"

if [[ $copyRTAS -gt 0 ]] && [[ $new_exe -nt $RTAS ]]; then
  echo "Copying to RTAS folder..."
  if [[ -d "$RTAS" ]]; then
    rm -r "$RTAS"

  cp -r "$original" "$RTAS"

I’ve been meaning to change that script to use rsync instead of cp, which should deal with that kind of issue automatically…