#!/bin/ksh

DEBUG_LOG_DIRECTORY=$1
DEBUG_LOG_FILE=$2

FATAL_ERROR=1000


## If the debug log path doesn't exist, create it.
if ! test -e "$DEBUG_LOG_DIRECTORY"
then
    if ! mkdir -p $DEBUG_LOG_DIRECTORY
    then
        printf "Unable to create log file directory:\n"
        printf "%s\n" "$DEBUG_LOG_DIRECTORY"
        ERROR=`./error_handler.ksh $FATAL_ERROR`
        printf "ERROR: $ERROR\n"
        exit 1
    fi
fi

# if the debug log file doesn't exist, create it
if ! test -e "$DEBUG_LOG_DIRECTORY/$DEBUG_LOG_FILE"
then
    if ! touch $DEBUG_LOG_DIRECTORY/$DEBUG_LOG_FILE
    then
        printf "Unable to create log file:\n"
        printf "%s\n" "$DEBUG_LOG_DIRECTORY/$DEBUG_LOG_FILE"
        ERROR=`./error_handler.ksh $FATAL_ERROR`
        printf "ERROR: $ERROR\n"
        exit 1
    fi
fi

exit 0
