diff --git a/apps/elixir_ls_utils/priv/debugger.sh b/apps/elixir_ls_utils/priv/debugger.sh index c89325a46..b5a95120d 100755 --- a/apps/elixir_ls_utils/priv/debugger.sh +++ b/apps/elixir_ls_utils/priv/debugger.sh @@ -1,8 +1,18 @@ #!/bin/sh # Launches the debugger. This script must be in the same directory as the compiled .ez archives. +readlink_f () { + cd "$(dirname "$1")" > /dev/null || exit 1 + filename="$(basename "$1")" + if [ -h "$filename" ]; then + readlink_f "$(readlink "$filename")" + else + echo "$(pwd -P)/$filename" + fi +} + if [ -z "${ELS_INSTALL_PREFIX}" ]; then - dir=$(dirname "$0") + dir="$(dirname "$(readlink_f "$0")")" else dir=${ELS_INSTALL_PREFIX} fi diff --git a/apps/elixir_ls_utils/priv/language_server.sh b/apps/elixir_ls_utils/priv/language_server.sh index 7f8c1944b..61b5e4b02 100755 --- a/apps/elixir_ls_utils/priv/language_server.sh +++ b/apps/elixir_ls_utils/priv/language_server.sh @@ -1,8 +1,18 @@ #!/bin/sh # Launches the language server. This script must be in the same directory as the compiled .ez archives. +readlink_f () { + cd "$(dirname "$1")" > /dev/null || exit 1 + filename="$(basename "$1")" + if [ -h "$filename" ]; then + readlink_f "$(readlink "$filename")" + else + echo "$(pwd -P)/$filename" + fi +} + if [ -z "${ELS_INSTALL_PREFIX}" ]; then - dir=$(dirname "$0") + dir="$(dirname "$(readlink_f "$0")")" else dir=${ELS_INSTALL_PREFIX} fi diff --git a/apps/elixir_ls_utils/priv/launch.sh b/apps/elixir_ls_utils/priv/launch.sh index 98b8f4214..d715d752a 100755 --- a/apps/elixir_ls_utils/priv/launch.sh +++ b/apps/elixir_ls_utils/priv/launch.sh @@ -52,7 +52,7 @@ fi # include the local .ez files, and then do what we were asked to do. readlink_f () { - cd "$(dirname "$1")" > /dev/null + cd "$(dirname "$1")" > /dev/null || exit 1 filename="$(basename "$1")" if [ -h "$filename" ]; then readlink_f "$(readlink "$filename")"