@echo off
if %1.==. goto usage
if not exist %1\bin\osa.exe goto baddir
echo Creating directory structure...
mkdir SYM 
mkdir SYM\BENCH 
mkdir SRC 
mkdir SRC\BENCH 
mkdir LST 
mkdir MSG 
mkdir IRF
mkdir PRJ
if errorlevel 1 goto error

echo Creating redirection file...
echo>osa.red *.msg  = %1\bin
echo>>osa.red *.cfg  = %1\bin
echo>>osa.red *.sym  = sym;%1\sym
echo>>osa.red *.class = src
echo>>osa.red *.java  = src
echo>>osa.red *.prj  = prj
echo>>osa.red *.irf  = irf
echo>>osa.red *.grf  = lst
echo>>osa.red *.lst  = lst
echo>>osa.red *.mes  = msg

echo Copying projects...
copy %1\prj\*.* prj 
copy %1\bin\side_eff.txt . 

echo Copying samples...
copy %1\samples\*.* src 
copy %1\samples\bench\*.* src\bench 


echo DONE
goto quit

:usage
echo Usage: osawork osa-root-path
goto quit

:baddir
echo %1 is not an OSA directory
goto quit

:error
echo ERROR
:quit

