Skip to content

Commit a9dd9b9

Browse files
committed
macOS-compatible realpath
1 parent cac6759 commit a9dd9b9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

miri

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ EOF
3939
TARGET=$(rustc --version --verbose | grep "^host:" | cut -d ' ' -f 2)
4040
SYSROOT=$(rustc --print sysroot)
4141
LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib
42-
if readlink -e . &>/dev/null; then
43-
# This platform supports `readlink -e`.
44-
MIRIDIR=$(dirname "$(readlink -e "$0")")
45-
else
46-
MIRIDIR=$(dirname "$0")
47-
fi
42+
# macOS does not have a useful readlink/realpath so we have to use Python instead...
43+
MIRIDIR=$(dirname "$(python -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$0")")
4844
if ! test -d "$LIBDIR"; then
4945
echo "Something went wrong determining the library dir."
5046
echo "I got $LIBDIR but that does not exist."

0 commit comments

Comments
 (0)