:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::                                                                           ::
:: This script builds OFXs and Omnidex indexes for the CONFIG directory      ::
::                                                                           ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

::
:: This script presumes it is being run from %OMNIDEX_HOME%\config
::

if NOT DEFINED OMNIDEX_HOME call ..\odxset.bat /NOBANNER

:: Apply write permissions to all files in config
attrib /S -R

:: Compile environment file
echo Deleting existing omnidex ...
del /f /q omnidex.env

echo Compiling omnidex ...
oacomp omnidex > oacomp.log || exit 1

:: Load OFX's
echo Loading OFXs for config files ...
odxsql -use=omnidexld -exit -noinit > omnidexld.log || exit 1

:: Index config directory
if not exist idx. ( mkdir idx. )
echo Deleting existing indexes ...
del /f /q idx\*

echo Indexing config tables ...
dbinstal < omnidexin > omnidexin.log || exit 1
