Skip to content

Commit

Permalink
Use readlink on Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioBenitez committed Oct 2, 2016
1 parent 4a09848 commit 8ff92ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8ff92ef

Please sign in to comment.