#!/bin/bash

ROOT_PATH="$(rospack find flexbe_app)"
NW=$ROOT_PATH/nwjs/nw
if [ ! -f $NW ]; then
    ROOT_PATH=.
    NW=$ROOT_PATH/nwjs/nw
fi
if [ ! -x $NW ]; then
  echo "Cannot run flexbe_app, need to download nwjs first."
  echo "Please build flexbe_app via catkin before using it or run the following command now:"
  echo "  rosrun flexbe_app nwjs_install"
  exit -1
fi

"$NW" --password-store=basic $ROOT_PATH "$@"
