scmversion: Fix generation on Macs

This commit is contained in:
Connor McLaughlin 2022-08-07 01:28:52 +10:00
parent b581cc4777
commit 73a80d3a1d
1 changed files with 6 additions and 1 deletions

View File

@ -3,7 +3,12 @@
VERSION_FILE="scmversion.cpp"
CURDIR=$(pwd)
if [ "$(uname -s)" == "Darwin" ]; then
cd "$(dirname $(python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0"))"
else
cd $(dirname $(readlink -f $0))
fi
HASH=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD | tr -d '\r\n')