Skip to content

Commit 950dad9

Browse files
committed
Simplify getting the absolute path during build
1 parent c19223b commit 950dad9

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

scripts/tasks.bash

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,12 @@ function binary-task() {
190190
log "Binary: ${buildPath}/${binaryName}"
191191
}
192192

193-
function absolute-path() {
194-
local relative="${1}"; shift
195-
if command -v realpath &> /dev/null ; then
196-
realpath "${relative}"
197-
else
198-
readlink -f "${relative}"
199-
fi
200-
}
201-
202193
# Check if it looks like we are inside VS Code.
203194
function in-vscode () {
204195
local dir="${1}" ; shift
205196
local maybeVsCode
206197
local dirName
207-
maybeVsCode="$(absolute-path "${dir}/../../..")"
198+
maybeVsCode="$(cd "${dir}/../../.." ; pwd -P)"
208199
dirName="$(basename "${maybeVsCode}")"
209200
if [[ "${dirName}" != "vscode" ]] ; then
210201
return 1
@@ -219,10 +210,8 @@ function in-vscode () {
219210
}
220211

221212
function main() {
222-
local relativeRootPath
223213
local rootPath
224-
relativeRootPath="$(dirname "${0}")/.."
225-
rootPath="$(absolute-path "${relativeRootPath}")"
214+
rootPath="$(cd "$(dirname "${0}/..")" ; pwd -P)"
226215

227216
local task="${1}" ; shift
228217
if [[ "${task}" == "ensure-in-vscode" ]] ; then

0 commit comments

Comments
 (0)