#!/bin/bash

# @file
# 
# @copyright
#  Copyright (c) 2016 Intel Corporation. All rights reserved
#  This software and associated documentation (if any) is furnished
#  under a license and may only be used or copied in accordance
#  with the terms of the license. Except as permitted by the
#  license, no part of this software or documentation may be
#  reproduced, stored in a retrieval system, or transmitted in any
#  form or by any means without the express written consent of
#  Intel Corporation.
#  This file contains a 'Sample Driver' and is licensed as such
#  under the terms of your license agreement with Intel or your
#  vendor. This file may be modified by the user, subject to
#  the additional terms of the license agreement.
# 
# @par Specification Reference:
#

CMDLINE=""
numargs=$#
for ((i=1 ; i <= numargs ; i++)); do
  if [ "$1" = "-e" ]; then
    CMDLINE+="$1 "
  elif [ "$1" = "-o" ]; then
    CMDLINE+="$1 "
  elif [ "$1" = "-d" ]; then
    CMDLINE+="$1 "
  else
    #CMDLINE+='"'
    CMDLINE+=`winepath -w $1`
    CMDLINE+=' '
  fi
  shift
done

export SIGNFV=`winepath -w $WORKSPACE/$CLIENT_COMMON_PACKAGE/Tools/SignFv`
export SIGNFVPLATFORM=`winepath -w $WORKSPACE/$PLATFORM_PACKAGE/Tools/ToolScripts/SignFv`
SIGNFVPLATFORMSCRIPT="$SIGNFVPLATFORM"
SIGNFVPLATFORMSCRIPT+='\SignFvPlatform_wine.bat'
export WORKSPACE=`winepath -w $WORKSPACE`
export CMDLINE=$CMDLINE

#CMD='wine cmd /c set PATH=%PATH%;'
#CMD+="$SIGNFV"
#CMD+=' & '
#CMD+="$SIGNFVPLATFORM"
#CMD+=' '
#CMD+="$CMDLINE"
#CMD="wine cmd /c $SIGNFVPLATFORM"
#echo
#echo "$CMD"
#echo
wine cmd /c $SIGNFVPLATFORMSCRIPT
ret=$?
if [ $ret -ne 0 ]; then
  echo
  #exit $ret
fi
