!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Macro to initialize system specific settings.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
startmacro

  debug off ALL

  if ^{env.nmroot} EQS "classpath:" then
    res customauxfile "classpath:/nxm/sys/cfg/customauxdef.mm"
	res z:jarFile true
  else
	file name customauxfile (^env.nmroot,nxm,sys,cfg) customauxdef mm
    res z:jarFile false
  endif

  if customauxfile fexists AND jarFile ISFALSE then
    %^customauxfile
  else
    if customauxfile fexists then
      warn "Ignoring custom aux file in jar file."
    endif
    ! portable way to define normal auxes (1 = /midas/data1/+/, etc.)
    file name u:aux.1  (midas,data1,+)
    set U:AUX.WEB "http://nextmidas.com/nm/nxm/sys/dat/"
  endif

  ! set write AUX and read AUX list
  aux 1 1 cwd dat ram

  ! NXM-4045 since NeXtMidas 4.1.4
  ! Check if HWC and DIR directory paths exist before adding them to the path
  invoke mymidas nxm.sys.lib.Shell.getMidasContext()
  invoke optPathHWC nxm.sys.lib.OptionTree.getOptionPath(mymidas,HWC,cfg)
  if optPathHWC neqs "NULL" then
    path add hwc
  endif
  invoke optPathDSP nxm.sys.lib.OptionTree.getOptionPath(mymidas,DSP,cfg)
  if optPathDSP neqs "NULL" then
    path add dsp
  endif

  ! moved to hwc/cfg/optstart.mm for NXM-2834
  ! env set "HWFILE" "nxm.sys.dat.hwconfig.prm"

  env set "KEYMAP" "nxm.sys.cfg.keyMap.tbl"

endmacro
