Merge "add CUR_DIR as a property for tradefed to find its own path"
diff --git a/script_help.sh b/script_help.sh
index 8dae495..17db12a 100755
--- a/script_help.sh
+++ b/script_help.sh
@@ -58,6 +58,7 @@
 
 # first try to find TF jars in same dir as this script
 CUR_DIR=$(dirname "$0")
+TF_JAR_DIR=$(dirname "$0")
 if [ -f "${CUR_DIR}/tradefed.jar" ]; then
     TF_PATH="${CUR_DIR}/*"
 elif [ ! -z "${ANDROID_HOST_OUT}" ]; then
@@ -66,6 +67,7 @@
     if [ -f "${ANDROID_HOST_OUT}/tradefed/tradefed.jar" ]; then
         # We intentionally pass the asterisk through without shell expansion
         TF_PATH="${ANDROID_HOST_OUT}/tradefed/*"
+        TF_JAR_DIR="${ANDROID_HOST_OUT}/tradefed/"
     fi
 fi
 
diff --git a/tradefed.sh b/tradefed.sh
index 804e9d2..23dcd5b 100755
--- a/tradefed.sh
+++ b/tradefed.sh
@@ -26,4 +26,4 @@
 
 # Note: must leave $RDBG_FLAG and $TRADEFED_OPTS unquoted so that they go away when unset
 java $RDBG_FLAG -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow $TRADEFED_OPTS \
-  -cp "${TF_PATH}" com.android.tradefed.command.Console "$@"
+  -cp "${TF_PATH}" -DTF_JAR_DIR=${TF_JAR_DIR} com.android.tradefed.command.Console "$@"