fix to take defaults from current dir

This commit is contained in:
Eric House 2012-08-26 20:18:37 -07:00
parent 6cf138b962
commit f3b289f4be

View file

@ -1,16 +1,47 @@
#!/bin/sh
set -e -u
DIR=""
NODE=""
usage() {
[ $# -gt 0 ] && echo "Error: $1"
echo "usage: $0 <dir> <pkg-node> "
echo "usage: $0 [--dir <dir>] [--node <pkg-node>] "
echo " # e.g. XWords4 or XWords4-dbg and xw4 or xw4_dbg"
exit 1
}
[ $# -gt 1 ] || usage "dir and node parameters required"
while [ $# -gt 1 ]; do
case $1 in
--dir)
shift
DIR=$1
;;
--node)
shift
NODE=$1
;;
*)
usage
;;
esac
shift
done
if [ -z "$DIR" ]; then
if [ -f ./AndroidManifest.xml ]; then # we're in the right directory
DIR=$(basename $(pwd))
fi
fi
if [ -z "$NODE" ]; then
if [ -f ./AndroidManifest.xml ]; then # we're in the right directory
NODE=$(grep 'package="org.eehouse.android' AndroidManifest.xml | sed 's,^.*android.\(.*\)",\1,')
fi
fi
[ -n "$DIR" -a -n "$NODE" ] || usage
DIR=$1
NODE=$2
BASE=$(dirname $0)
cd $BASE/../${DIR}/bin/classes