@REM To RUN this batch file you need a zip8 batch file in the path!!!
@setlocal
@set TEMPVER=
@call zipsetup
@if "%TEMPVERS%x" == "x" goto ERR1
@set TEMPZF=..\..\..\atlas-%TEMPVERS%-exe.zip
@echo Zipping the runtime binary executable - Release only - to %TEMPZF%
@set TEMP1=-a
@if NOT EXIST %TEMPZF% goto DNUP
@echo WARNING: %TEMPZF% already exists ... doing UPDATE only ...
@set TEMP1=-u
:DNUP
@set TEMPE1=bin\Atlas.exe
@set TEMPE2=bin\Map.exe
@set TEMPE3=bin\GetMap.exe
@REM set TEMPE4=Release\MapPS\MapPS.exe
@set TEMPE4=

@if NOT EXIST %TEMPE1% goto ERR2
@if NOT EXIST %TEMPE2% goto ERR3
@if EXIST %TEMPE3% goto GOTE3
@echo WARNING: %TEMPE3% NOT FOUND, thus will NOT be included ...
:GOTE3

@REM if EXIST %TEMPE4% goto GOTE4
@REM echo WARNING: %TEMPE4% NOT FOUND, thus will NOT be included ...
:GOTE4

@set TEMP1=%TEMP1% -o
@echo Will run follwing command ...
@echo call zip8 %TEMP1% %TEMPZF% %TEMPE1% %TEMPE2% %TEMPE3% %TEMPE4%
@echo Continue? Ctrl+C, or Ctrl+Break to abort batch ...
@pause

call zip8 %TEMP1% %TEMPZF% %TEMPE1% %TEMPE2% %TEMPE3% %TEMPE4%
@if ERRORLEVEL 1 goto ZIPERR
@dir %TEMPZF%
@if NOT EXIST %TEMPZF% goto ERRNZ
@goto END

:ZIPERR
@echo zip8 batch returned ERRORLEVEL %ERRORLEVEL% !!!
@echo Perhaps zip8.bat batch files is NOT in the path ...
@echo SOme other error has occurred ...
@goto WAIT

:ERR1
@echo ERROR: The version, TEMPVERS environment variable not set ... can not build zip file ...
@goto WAIT
:ERR2
@echo ERROR: Can NOT locate %TEMPE1% file. Has build been done? ... can not build zip file ...
@goto WAIT
:ERR3
@echo ERROR: Can NOT locate %TEMPE2% file. Has build been done? ... can not build zip file ...
@goto WAIT
:ERRNZ
@echo ERROR: Creation of ZIP %TEMPZF% failed ... maybe no zip8.bat batch file available ...
@goto WAIT

:WAIT
@pause
:END
@endlocal
