From a24e90305ff9347219cf289d3f6c5ea89f7d418c Mon Sep 17 00:00:00 2001 From: Alfred Morgan Date: Wed, 25 May 2016 17:54:11 -0700 Subject: [PATCH] fixed #4179 bin/flutter fails when linked with relative symlink (#4196) * fixed issue #4179 bin/flutter fails when linked with relative symlink * fixed issue #4179 bin/flutter fails when linked with relative symlink * My second attempt at following symlinks correctly --- bin/flutter | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/flutter b/bin/flutter index 7229d89369b..610f57b15bd 100755 --- a/bin/flutter +++ b/bin/flutter @@ -6,12 +6,16 @@ set -e function follow_links() { - file="$1" + cd -P "${1%/*}" + file="$PWD/${1##*/}" while [ -h "$file" ]; do # On Mac OS, readlink -f doesn't work. + cd -P "${file%/*}" file="$(readlink "$file")" + cd -P "${file%/*}" + file="$PWD/${file##*/}" done - echo "$file" + echo "$PWD/${file##*/}" } PROG_NAME="$(follow_links "$BASH_SOURCE")"