realpath doesn't exist on OSX
jakearchibald opened this issue · comments
Jake Archibald commented
But it can be installed via
brew install coreutils
Domenic Denicola commented
Some good alternatives here... http://stackoverflow.com/q/3572030/3191
Michael[tm] Smith commented
Some good alternatives here... http://stackoverflow.com/q/3572030/3191
Of those http://stackoverflow.com/a/18443300/441757 looks like those most useful:
#!/bin/sh
realpath() {
OURPWD=$PWD
cd "$(dirname "$1")"
LINK=$(readlink "$(basename "$1")")
while [ "$LINK" ]; do
cd "$(dirname "$LINK")"
LINK=$(readlink "$(basename "$1")")
done
REALPATH="$PWD/$(basename "$1")"
cd "$OURPWD"
echo "$REALPATH"
}
realpath "$@"
I’ll open a PR with a patch that uses that instead.
Michael[tm] Smith commented
OK I see now a complication is that the code is actually using realpath
with --relative-to
:
SOURCE_RELATIVE=$(realpath --relative-to=. $HTML_SOURCE
…so will also need to see if we can emulate that.
Domenic Denicola commented
Apparently Ubuntu doesn't have --relative-to either... going to try a few fixes here.