diff options
author | Joe Onorato <joeo@android.com> | 2009-07-30 10:23:21 -0700 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-07-30 10:24:28 -0700 |
commit | 2a5d4d81b2137a2262da8efe76ff70db99c9c2ce (patch) | |
tree | 7d6de888e14537bb93854fbc4622f312ad98d95c /envsetup.sh | |
parent | 1951d0eed961b122779c8015e48494d1f93094a4 (diff) | |
download | build-2a5d4d81b2137a2262da8efe76ff70db99c9c2ce.zip build-2a5d4d81b2137a2262da8efe76ff70db99c9c2ce.tar.gz build-2a5d4d81b2137a2262da8efe76ff70db99c9c2ce.tar.bz2 |
Add cproj function to envsetup.sh that finds an Android.mk and goes to its directory.
Diffstat (limited to 'envsetup.sh')
-rw-r--r-- | envsetup.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/envsetup.sh b/envsetup.sh index 4ef6d77..9eeab02 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -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" |