#!/bin/sh -x
#
#   Rebuild and run under flashplayer debugger.
#	NOTE: We need to hardcode tomcat.port below.
#
#   Beforehand, create ~/mm.cfg (%HOME\%HOMEPATH%\mm.cfg) containing:
#       ErrorReportingEnable=1
#       TraceOutputFileEnable=1
#       MaxWarnings=0
#   
#   Ant extracts the Linux FLASHPLAYER (see the "unzip-blazeds" target).
FLASHPLAYER=`pwd`/blazeds/resources/flex_sdk/runtimes/player/lnx/flashplayer
LOG=${HOME}/.macromedia/Flash_Player/Logs/flashlog.txt
#
#   Under Windows Command Prompt, use go.bat.
#   Under Windows Cygwin, uncomment the following:
#FLASHPLAYER=blazeds/resources/flex_sdk/runtimes/player/win/FlashPlayer.exe
#MM="C:/Documents and Settings/kirke/Application Data/Macromedia"
#LOG="${MM}/Flash Player/Logs/flashlog.txt"
#
mkdir -p log
rm "${LOG}"
(date
uname -a
#   clean removes database
#ant clean
if (ant); then
	sleep 10
    (sleep 5; tail -n 500 -F "${LOG}") &
    "${FLASHPLAYER}" http://localhost:8400/mp3dj/main.swf
fi
date) 2>&1 | tee log/`date '+%Y-%m%d-%H%M'`
