From 8ff92efc934253e66d28d8c234dfd5443b5a09bb Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Sun, 2 Oct 2016 01:23:28 -0700 Subject: [PATCH] Use readlink on Linux. --- scripts/config.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/config.sh b/scripts/config.sh index 40b444e4..565df65a 100755 --- a/scripts/config.sh +++ b/scripts/config.sh @@ -4,7 +4,13 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" function relative() { local full_path="${SCRIPT_DIR}/../${1}" - echo $(realpath "${full_path}") + + # Use readlink as a fallback to readpath for cross-platform compat. + if ! command -v realpath >/dev/null 2>&1; then + echo $(readlink -f "${full_path}") + else + echo $(realpath "${full_path}") + fi } EXAMPLES_DIR=$(relative "examples")