#!/bin/sh

#
# Autogenerated by OTB installation process
# DO NOT MODIFY
#

CURRENT_SCRIPT_DIR=$(dirname "$0")

if [ -e "$CURRENT_SCRIPT_DIR/otbApplicationLauncherCommandLine" ]
then
  # Prefer using the launcher inside the script dir
  OTB_CLI_LAUNCHER=$CURRENT_SCRIPT_DIR/otbApplicationLauncherCommandLine
else
  # Use the one from the PATH
  OTB_CLI_LAUNCHER=otbApplicationLauncherCommandLine
fi

# works for install tree
if [ -d "$CURRENT_SCRIPT_DIR/../lib/otb/applications" ]
then
  OTB_APPLICATION_PATH=$CURRENT_SCRIPT_DIR/../lib/otb/applications:$OTB_APPLICATION_PATH
fi

# export it to make it available to otbApplicationLauncherCommandLine environment
export OTB_APPLICATION_PATH

# avoid numerical issues caused by locale
export LC_NUMERIC=C

# Export GDAL_DATA, EPSG_CSV
# Note that OTB_APPLICATION_PATH is reset here.
if [ -f "$CURRENT_SCRIPT_DIR/../otbenv.profile" ]; then
    . "$CURRENT_SCRIPT_DIR/../otbenv.profile"
fi

# start the application
$OTB_CLI_LAUNCHER "$@"
