Skip to content

Commit 843e1a6

Browse files
authored
Make wrapper script more robust (#445)
This makes a setup possible in which a symlink points to the file (e.g. /usr/local/bin/elixir-ls -> /opt/elixir-ls/language_server.sh). Co-authored-by: Joshua Trees <[email protected]>
1 parent 93f8996 commit 843e1a6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/elixir_ls_utils/priv/language_server.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/bin/sh
22
# Launches the language server. This script must be in the same directory as the compiled .ez archives.
33

4-
dir=$(dirname "$0")
4+
readlink_f () {
5+
cd "$(dirname "$1")" > /dev/null
6+
filename="$(basename "$1")"
7+
if [ -h "$filename" ]; then
8+
readlink_f "$(readlink "$filename")"
9+
else
10+
echo "$(pwd -P)/$filename"
11+
fi
12+
}
13+
14+
dir=$(dirname $(readlink_f "$0"))
515

616
export ELS_MODE=language_server
717
export ELS_SCRIPT="ElixirLS.LanguageServer.CLI.main()"

0 commit comments

Comments
 (0)