]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add Fallback When realpath Doesn't Support --relative-to
authorW. Felix Handte <w@felixhandte.com>
Mon, 4 May 2020 22:59:47 +0000 (18:59 -0400)
committerW. Felix Handte <w@felixhandte.com>
Mon, 4 May 2020 22:59:47 +0000 (18:59 -0400)
contrib/single_file_libs/combine.sh

index a98eef28396579e8dd1e63d43b88d3233de6706f..40f42025613b5a374e1d4a844eb61cf9ca0f44da 100755 (executable)
@@ -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