From: W. Felix Handte Date: Mon, 4 May 2020 22:59:47 +0000 (-0400) Subject: Add Fallback When realpath Doesn't Support --relative-to X-Git-Tag: v1.4.5^2~43^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6381b7ee3f6a4cbee65d490fae464915e722aebd;p=thirdparty%2Fzstd.git Add Fallback When realpath Doesn't Support --relative-to --- diff --git a/contrib/single_file_libs/combine.sh b/contrib/single_file_libs/combine.sh index a98eef283..40f420256 100755 --- a/contrib/single_file_libs/combine.sh +++ b/contrib/single_file_libs/combine.sh @@ -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