@echo off

rem Run this BAT-script with one argument specifying:
rem 1) full path to the user geometry file.

rem Initialize variables
call Core\scripts\win-win\params.bat

set RESDIR=results
set PARAMS_HOC=params.hoc

rem Go to Matlab host directory
cd %MATLABHOSTDIR%

rem Delete the old results folder from Matlab host directory (if any)
if exist %RESDIR% rmdir /S /Q %RESDIR%

rem Copy HOC parameters file to HPC kernel directory
xcopy %PARAMS_HOC% "%HPCDIR%" /Y /Q

rem If specified, copy the selected HOC geometry file
if NOT "%1" == "" (
    xcopy "%1" "%HPCDIR%\user_geometry" /Y /Q
)

rem Delete the autogenerated file
cd %MATLABHOSTDIR%
del %PARAMS_HOC%