Index: sdk/bin/dartanalyzer_developer |
diff --git a/sdk/bin/dartanalyzer_developer b/sdk/bin/dartanalyzer_developer |
index b522f56902026a1469a2af28b288a8b808eec2f6..3fadd7585c67d269015a8e9bc8b9d6a9d45f0736 100755 |
--- a/sdk/bin/dartanalyzer_developer |
+++ b/sdk/bin/dartanalyzer_developer |
@@ -8,21 +8,19 @@ |
# the testing infrastructure. |
set -e |
-function follow_links() { |
- while [ -h "$1" ]; do |
+function link_dir() { |
+ a="$1" |
+ while [ -h "$a" ]; do |
# On Mac OS, readlink -f doesn't work. |
- 1="$(readlink "$1")" |
+ a="$(readlink "$a")" |
done |
- echo "$1" |
+ # if dir linked, not file, need to follow dir path: |
+ echo $(cd $(dirname $a); pwd -P) |
} |
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
-PROG_NAME="$(follow_links "$BASH_SOURCE")" |
- |
# Handle the case where the binary dir has been symlinked to. |
-CUR_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" |
- |
-SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)" |
+CUR_DIR="$(link_dir "$0")" |
+SDK_DIR="${CUR_DIR}%/*"} |
if [ -z "$DART_CONFIGURATION" ]; |
then |