1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-27 04:35:25 +00:00

Simplify getting the absolute path during build

This commit is contained in:
Asher 2019-08-21 14:13:26 -05:00
parent c19223b7fe
commit 950dad9489
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -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