* 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
This commit is contained in:
parent
c69cff9428
commit
a24e90305f
@ -6,12 +6,16 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
function follow_links() {
|
function follow_links() {
|
||||||
file="$1"
|
cd -P "${1%/*}"
|
||||||
|
file="$PWD/${1##*/}"
|
||||||
while [ -h "$file" ]; do
|
while [ -h "$file" ]; do
|
||||||
# On Mac OS, readlink -f doesn't work.
|
# On Mac OS, readlink -f doesn't work.
|
||||||
|
cd -P "${file%/*}"
|
||||||
file="$(readlink "$file")"
|
file="$(readlink "$file")"
|
||||||
|
cd -P "${file%/*}"
|
||||||
|
file="$PWD/${file##*/}"
|
||||||
done
|
done
|
||||||
echo "$file"
|
echo "$PWD/${file##*/}"
|
||||||
}
|
}
|
||||||
|
|
||||||
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user