Add Fallback When realpath Doesn't Support --relative-to

This commit is contained in:
W. Felix Handte 2020-05-04 18:59:47 -04:00
parent c7cba8e87c
commit 6381b7ee3f

View File

@ -72,7 +72,11 @@ resolve_include() {
local inc=$2
for root in $srcdir $ROOTS; do
if [ -f "$root/$inc" ]; then
echo "$(realpath --relative-to . "$root/$inc")"
local relpath="$(realpath --relative-to . "$root/$inc")"
if [ "$?" -eq "0" ]; then # not all realpaths support --relative-to
relpath="$(realpath "$root/$inc")"
fi
echo "$relpath"
return 0
fi
done