:: (c) 2003-2007 Electronic Arts Inc.
@echo off
setlocal
if "%1"=="pc" goto doall
if "%1"=="" goto help
if "%1"=="?" goto help
set ARG=%1
set FILE=%ARG:.exe=%
if not exist %FILE%.exe goto help

set XLIBSUTIL=%DEPOT%\xlibs\util\dev
if "%BVERSION%" == "release" set XLIBSUTIL=%DEPOT%\xlibs\util\1

set UTILFOLDER=%DEPOT%\util
echo Saving to %UTILFOLDER%

rem sync is to avoid edit on old file which causes a submit issue
p4 sync image\pc\%FILE%.exe
p4 edit image\pc\%FILE%.exe
xcopy /c /k /r /y %2 %3 %4 %5 %6 %FILE%.exe image\pc

p4 sync %XLIBSUTIL%\pc\%FILE%.exe
p4 edit %XLIBSUTIL%\pc\%FILE%.exe
xcopy /c /k /r /y %2 %3 %4 %5 %6 %FILE%.exe %XLIBSUTIL%\pc\

p4 sync %UTILFOLDER%\%FILE%.exe
p4 edit %UTILFOLDER%\%FILE%.exe
xcopy /c /k /r /y %2 %3 %4 %5 %6 %FILE%.exe %UTILFOLDER%

if not exist l:\enviro\util\pc\unofficial\gsr.exe goto done
echo Saving to enviro
xcopy /c /k /r /y %2 %3 %4 %5 %6 %FILE%.exe l:\enviro\util\pc\unofficial

goto done

:doall
echo Posting Tools to Enviro\util\pc\unofficial
zrun post *.exe=*

goto done

:help
echo post pc
echo post [tool]

:done

