yet another launcher script


I’m tired of the clickToRunScripts when running multiple of apps from the command line, so I made a generic script to launch the app and load the lib dir based on the dir path given. If you make it executable and throw it in you /usr/bin dir, then it makes things quicker, at least for me.

Try it out for me.

#	generic script to launch openframeworks apps in linux  
#	automatically loads lib dir  
#	2008 Dan Wilcox  
#### Variables/Definitions  
HELP="Usage: oflauncher [options] /path/to/application  
 Starts an openframeworks app in the given dir,   
 automatically adds the lib path  
 -h, --help		This usage guide  
 -l, -libdir	Specify the lib directory  
#### BEGIN commandline parsing  
# We need TEMP as the `eval set --' would nuke the return value of getopt.  
TEMP=`getopt -o c:l:h:: --long config: --long libdir: --long help:: \  
	  -n "oflauncher" -- "$@"`  
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi  
# Note the quotes around `$TEMP': they are essential!  
eval set -- "$TEMP"  
while true ; do  
	case "$1" in  
		-h|--help)	# print help and exit  
			echo "$HELP"; exit 0 ;;  
		-l|--libdir)	# grab library dir  
			case "$2" in  
				*)  DIR=$2 ;  shift 2 ;;  
			esac ;;  
		--) shift ; break ;;	# do nothing  
		*) break ;;  
# get program name from commandline  
if [ "$1" != "" ] ; then  
# if program name dosent exist, exit  
if [ ! -e $APP ] ; then  
	echo "oflauncher: '$(basename $APP)' does not exist, exiting"  
	exit 0  
# set lib dir, if not specified  
if [ "$DIR" = "" ] ; then  
	DIR=$(dirname $APP)/libs/  
#### Begin execution  
echo "oflauncher: cd to '$(dirname $APP)'"  
cd $(dirname $APP)  
echo "oflauncher: adding lib path: '$DIR'"  
# add lib path  
echo "oflauncher: running $(basename $APP)"  
# run app  
./$(basename $APP)  
echo "oflauncher: done"