From 040b4763595f9ee69b5249918e3d1760d402e242 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Tue, 31 Jan 2017 19:25:15 +0100 Subject: [PATCH] Manually implement realpath for OS X --- release-tool | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/release-tool b/release-tool index de5c723c9..11fdf501e 100755 --- a/release-tool +++ b/release-tool @@ -244,6 +244,26 @@ checkTransifexCommandExists() { fi } +# re-implement realpath for OS X (thanks mschrag) +# https://superuser.com/questions/205127/how-to-retrieve-the-absolute-path-of-an-arbitrary-file-from-the-os-x +if [ "$(uname -s)" == "Darwin" ]; then + realpath() { + pushd . > /dev/null + if [ -d "$1" ]; then + cd "$1"; dirs -l +0 + else cd "`dirname \"$1\"`" + cur_dir=`dirs -l +0` + + if [ "$cur_dir" == "/" ]; then + echo "$cur_dir`basename \"$1\"`" + else + echo "$cur_dir/`basename \"$1\"`" + fi + fi + popd > /dev/null + } +fi + trap exitTrap SIGINT SIGTERM