fix(yt-wsp): Resolve script path without GNU realpath (#4072)

macOS ships BSD realpath, which rejects -e and is missing on older
releases. Use plain realpath when present, otherwise cd and pwd -P.

Fixes #530

Co-authored-by: Aurora-NICExq <Aurora-NICExq@users.noreply.github.com>
This commit is contained in:
Aurora-NICExq
2026-09-18 12:20:25 +02:00
committed by GitHub
co-authored by Aurora-NICExq
parent b27fbff411
commit 5670d5c0bb
+5 -1
View File
@@ -39,7 +39,11 @@
set -Eeuo pipefail
# get script file location
SCRIPT_PATH="$(realpath -e ${BASH_SOURCE[0]})";
if [ -x "$(command -v realpath)" ]; then
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
else
SCRIPT_PATH="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd -P)/$(basename -- "${BASH_SOURCE[0]}")"
fi
SCRIPT_DIR="${SCRIPT_PATH%/*}"
################################################################################