Skip to content

Commit ff4bb6f

Browse files
authored
Merge pull request #834 from dennisjbell/master
Fix `Class MMBackend` duplication bug on launch
2 parents 803f090 + 256ce63 commit ff4bb6f

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

src/MacVim/mvim

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,17 @@
1111
# Bjorn Winckler (Aug 13 2007).
1212

1313
# Find Vim executable
14-
if [ -L "$0" ]; then
15-
# readlink -f
16-
curdir=`pwd -P`
17-
self_path=$0
18-
cd "`dirname $self_path`"
19-
while [ -L "$self_path" ]; do
20-
self_path=`readlink $self_path`
21-
cd "`dirname $self_path`"
22-
self_path=`basename $self_path`
23-
done
24-
binary="`pwd -P`/../MacOS/Vim"
25-
cd "$curdir"
26-
else
27-
binary="`dirname "$0"`/../MacOS/Vim"
28-
fi
14+
orig_path="$(pwd -P)"
15+
self_path="$0"
16+
while [ -L "$self_path" ]; do # dereference links
17+
link="$(basename "$self_path")"
18+
cd "$(dirname "$self_path")"
19+
self_path="$(readlink "$link")"
20+
done
21+
cd "$(dirname "$self_path")"
22+
binary="$(dirname "$(pwd -P)")/MacOS/Vim"
23+
cd "$orig_path"
24+
2925
if ! [ -x "$binary" ]; then
3026
echo "Sorry, cannot find Vim executable."
3127
exit 1

0 commit comments

Comments
 (0)