Skip to content

Commit

Permalink
Recursively resolve symlinks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andersbakken committed Nov 8, 2014
1 parent 884c804 commit cef323f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/gcc-rtags-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ if [ "$RTAGS_GCC_WRAPPER" = "1" ]; then
echo 1>&2 "Recursive invocation of gcc-rtags-wrapper.sh detected"
exit 1
fi

rc=$(which rc)
for i in $(which -a "$(basename "$0")"); do
filename=$(basename "$(readlink "$i")")
filename="$i"
max=10
while [ $max -gt 0 -a -L "$filename" ]; do
max=$((max - 1))
link=$(readlink "$i")
if echo "$link" | grep --quiet "^/"; then
filename="$link"
else
filename="$(dirname $filename)/$link"
fi
done

filename=$(basename "$filename")
if [ "$filename" != "gcc-rtags-wrapper.sh" ] && [ -z "$PLAST" -o "$filename" != "plastc" ]; then
[ -n "$RTAGS_SERVER_FILE" ] && RTAGS_ARGS="$RTAGS_ARGS -n$RTAGS_SERVER_FILE"
[ -n "$RTAGS_PROJECT" ] && RTAGS_ARGS="$RTAGS_ARGS --project-root=$RTAGS_PROJECT"
Expand Down

0 comments on commit cef323f

Please sign in to comment.