vscode/scripts/code-cli.sh
Robo d0e516655a
fix: rename product executable on macOS (#291948)
* fix: rename product executable name on macOS

* chore: update test/automation/src/electron.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: update test/automation/src/electron.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* chore: rename in additional places

* chore: rename in code-perf.js

* chore: create symlink for backwards compatibility

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-03 14:50:21 -08:00

48 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
function code() {
cd $ROOT
if [[ "$OSTYPE" == "darwin"* ]]; then
NAME=`node -p "require('./product.json').nameLong"`
EXE_NAME=`node -p "require('./product.json').nameShort"`
CODE="./.build/electron/$NAME.app/Contents/MacOS/$EXE_NAME"
else
NAME=`node -p "require('./product.json').applicationName"`
CODE=".build/electron/$NAME"
fi
# Get electron, compile, built-in extensions
if [[ -z "${VSCODE_SKIP_PRELAUNCH}" ]]; then
node build/lib/preLaunch.ts
fi
# Manage built-in extensions
if [[ "$1" == "--builtin" ]]; then
exec "$CODE" build/builtin
return
fi
# Disable test extension
DISABLE_TEST_EXTENSION="--disable-extension=vscode.vscode-api-tests"
if [[ "$@" == *"--extensionTestsPath"* ]]; then
DISABLE_TEST_EXTENSION=""
fi
ELECTRON_RUN_AS_NODE=1 \
NODE_ENV=development \
VSCODE_DEV=1 \
ELECTRON_ENABLE_LOGGING=1 \
ELECTRON_ENABLE_STACK_DUMPING=1 \
"$CODE" --inspect=5874 "$ROOT/out/cli.js" . $DISABLE_TEST_EXTENSION "$@"
}
code "$@"