#!/bin/sh
#########################################################################
# (c) 2005-2014 Copyright, Real-Time Innovations. All rights reserved.  #
# No duplications, whole or partial, manual or electronic, may be made  #
# without express written permission.  Any such copies, or              #
# revisions thereof, must display this notice unaltered.                #
# This code contains trade secrets of Real-Time Innovations, Inc.       #
#########################################################################

filename=$0
collect_telemetry="false"
script_dir=`cd "\`dirname "$filename"\`"; pwd`
executable_name=rtiddsgen2
script_version=7.7.0.0
needs_shared_libraries="false"

rticommon_script_dir=$script_dir/../resource/scripts
rticommon_script_name=rticommon.sh
. "$rticommon_script_dir/$rticommon_script_name"
rtiddsgen2_jar=$app_lib_java_dir/rtiddsgen2.jar

ndds_resource_dir=$app_support_dir/rtiddsgen

if [ -f $app_lib_java_dir/rtiddsgen_dotnet.jar ]
then
    for arg in "$@"
    do
        if [ "c#" = "$arg" ] || [ "C#" = "$arg" ] || [ "-help" = "$arg" ] || [ "-h" = "$arg" ]
        then

            # With language C# selected, and rtiddsgen_dotnet.jar installed
            # we run the patched rtiddsgen version for the new C# binding;
            # in any other case we run the regular 6.1.0 rtiddsgen.
            rtiddsgen2_jar=$app_lib_java_dir/rtiddsgen_dotnet.jar
            ndds_resource_dir=$app_support_dir/rtiddsgen_dotnet
            break
        fi
    done
fi

"$bin_dir/$platform_name/$executable_name" \
    -n_nddsresource "$ndds_resource_dir" \
    -n_resolvelo \
    -n_nddshome "$NDDSHOME" \
    -n_serverport 14662 \
    -n_servertimeout 120000 \
    -n_classpath "$rtiddsgen2_jar" "$@"
