From 950dad9489d988a6f705d80f6a088fbcc77c8cde Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 21 Aug 2019 14:13:26 -0500 Subject: [PATCH] Simplify getting the absolute path during build --- scripts/tasks.bash | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/scripts/tasks.bash b/scripts/tasks.bash index ce5e32e9..5d0a0c20 100755 --- a/scripts/tasks.bash +++ b/scripts/tasks.bash @@ -190,21 +190,12 @@ function binary-task() { log "Binary: ${buildPath}/${binaryName}" } -function absolute-path() { - local relative="${1}"; shift - if command -v realpath &> /dev/null ; then - realpath "${relative}" - else - readlink -f "${relative}" - fi -} - # Check if it looks like we are inside VS Code. function in-vscode () { local dir="${1}" ; shift local maybeVsCode local dirName - maybeVsCode="$(absolute-path "${dir}/../../..")" + maybeVsCode="$(cd "${dir}/../../.." ; pwd -P)" dirName="$(basename "${maybeVsCode}")" if [[ "${dirName}" != "vscode" ]] ; then return 1 @@ -219,10 +210,8 @@ function in-vscode () { } function main() { - local relativeRootPath local rootPath - relativeRootPath="$(dirname "${0}")/.." - rootPath="$(absolute-path "${relativeRootPath}")" + rootPath="$(cd "$(dirname "${0}/..")" ; pwd -P)" local task="${1}" ; shift if [[ "${task}" == "ensure-in-vscode" ]] ; then