mirror of https://github.com/coder/code-server.git
Simplify getting the absolute path during build
This commit is contained in:
parent
c19223b7fe
commit
950dad9489
|
@ -190,21 +190,12 @@ function binary-task() {
|
||||||
log "Binary: ${buildPath}/${binaryName}"
|
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.
|
# Check if it looks like we are inside VS Code.
|
||||||
function in-vscode () {
|
function in-vscode () {
|
||||||
local dir="${1}" ; shift
|
local dir="${1}" ; shift
|
||||||
local maybeVsCode
|
local maybeVsCode
|
||||||
local dirName
|
local dirName
|
||||||
maybeVsCode="$(absolute-path "${dir}/../../..")"
|
maybeVsCode="$(cd "${dir}/../../.." ; pwd -P)"
|
||||||
dirName="$(basename "${maybeVsCode}")"
|
dirName="$(basename "${maybeVsCode}")"
|
||||||
if [[ "${dirName}" != "vscode" ]] ; then
|
if [[ "${dirName}" != "vscode" ]] ; then
|
||||||
return 1
|
return 1
|
||||||
|
@ -219,10 +210,8 @@ function in-vscode () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
local relativeRootPath
|
|
||||||
local rootPath
|
local rootPath
|
||||||
relativeRootPath="$(dirname "${0}")/.."
|
rootPath="$(cd "$(dirname "${0}/..")" ; pwd -P)"
|
||||||
rootPath="$(absolute-path "${relativeRootPath}")"
|
|
||||||
|
|
||||||
local task="${1}" ; shift
|
local task="${1}" ; shift
|
||||||
if [[ "${task}" == "ensure-in-vscode" ]] ; then
|
if [[ "${task}" == "ensure-in-vscode" ]] ; then
|
||||||
|
|
Loading…
Reference in New Issue