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

Commit

Permalink
fix: windows script
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 20, 2018
1 parent 8414faf commit f475609
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/tarballs/bin.ts
Expand Up @@ -2,23 +2,25 @@ import * as Config from '@oclif/config'
import * as qq from 'qqjs'

export async function writeBinScripts({config, baseWorkspace, nodeVersion}: {config: Config.IConfig, baseWorkspace: string, nodeVersion: string}) {
const {bin} = config
const binPathEnvVar = config.scopedEnvVarKey('BINPATH')
const redirectedEnvVar = config.scopedEnvVarKey('REDIRECTED')
const writeWin32 = async () => {
await qq.write([baseWorkspace, 'bin', `${config.bin}.cmd`], `@echo off
if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${config.bin}.cmd" (
if not "%${redirectedEnvVar}%"=="1" if exist "%LOCALAPPDATA%\\${bin}\\client\\bin\\${bin}.cmd" (
set ${redirectedEnvVar}=1
"%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${config.bin}.cmd" %*
rem "%LOCALAPPDATA%\\${bin}\\client\\bin\\${bin}.cmd" %*
exit /B
)
set ${binPathEnvVar}="%~dp0${bin}.cmd"
if exist "%~dp0..\\bin\\node.exe" (
"%~dp0..\\bin\\node.exe" "%~dp0..\\bin\\run" %*
) else if exist "%LOCALAPPDATA%\\oclif\\node\\node-${nodeVersion}.exe" (
"%LOCALAPPDATA%\\oclif\\node\\node-${nodeVersion}.exe" "%~dp0..\\bin\\run" %*
) else (
set ${binPathEnvVar}="%~dp0\\${config.bin}.cmd"
if exist "%~dp0\\..\\client\\bin\\node.exe" (
"%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\bin\\run" %*
) else if exist "%LOCALAPPDATA%\\oclif\\node\\node-${nodeVersion}.exe" (
"%LOCALAPPDATA%\\oclif\\node\\node-${nodeVersion}.exe" "%~dp0\\..\\client\\bin\\run" %*
) else (
node "%~dp0\\..\\client\\bin\\run" %*
)
node "%~dp0..\\bin\\run" %*
)
`)
// await qq.write([output, 'bin', config.bin], `#!/bin/sh
Expand Down

0 comments on commit f475609

Please sign in to comment.