Add cproj function to envsetup.sh that finds an Android.mk and goes to its directory.

This commit is contained in:
Joe Onorato 2009-07-30 10:23:21 -07:00
parent 1951d0eed9
commit 2a5d4d81b2
1 changed files with 20 additions and 0 deletions

View File

@ -656,6 +656,26 @@ function croot()
fi
}
function cproj()
{
TOPFILE=build/core/envsetup.mk
# We redirect cd to /dev/null in case it's aliased to
# a command that prints something as a side-effect
# (like pushd)
local HERE=$PWD
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
T=$PWD
if [ -f "$T/Android.mk" ]; then
cd $T
return
fi
cd .. > /dev/null
done
cd $HERE > /dev/null
echo "can't find Android.mk"
}
function pid()
{
local EXE="$1"