Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
feat: support OCLIF_CLIENT_HOME env var (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx authored Jun 19, 2018
1 parent d40dc75 commit a49ddb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tarballs/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as qq from 'qqjs'
export async function writeBinScripts({config, baseWorkspace, nodeVersion}: {config: Config.IConfig, baseWorkspace: string, nodeVersion: string}) {
const binPathEnvVar = config.scopedEnvVarKey('BINPATH')
const redirectedEnvVar = config.scopedEnvVarKey('REDIRECTED')
const clientHomeEnvVar = config.scopedEnvVarKey('OCLIF_CLIENT_HOME')
const writeWin32 = async () => {
const {bin} = config
await qq.write([baseWorkspace, 'bin', `${config.bin}.cmd`], `@echo off
Expand Down Expand Up @@ -52,7 +53,8 @@ get_script_dir () {
DIR=\$(get_script_dir)
CLI_HOME=\$(cd && pwd)
XDG_DATA_HOME=\${XDG_DATA_HOME:="\$CLI_HOME/.local/share"}
BIN_PATH="\$XDG_DATA_HOME/${config.dirname}/client/bin/${config.bin}"
CLIENT_HOME=\${${clientHomeEnvVar}:=$XDG_DATA_HOME/${config.dirname}/client}
BIN_PATH="\$CLIENT_HOME/bin/${config.bin}"
if [ -z "\$${redirectedEnvVar}" ] && [ -x "\$BIN_PATH" ] && [[ ! "\$DIR/${config.bin}" -ef "\$BIN_PATH" ]]; then
if [ "\$DEBUG" == "*" ]; then
echoerr "\$BIN_PATH" "\$@"
Expand Down

0 comments on commit a49ddb8

Please sign in to comment.