diff --git a/scripts/code-cli.sh b/scripts/code-cli.sh index f9a6d337be9..d04f7cced91 100755 --- a/scripts/code-cli.sh +++ b/scripts/code-cli.sh @@ -10,32 +10,32 @@ fi function code() { cd $ROOT + if [[ "$OSTYPE" == "darwin"* ]]; then + NAME=`node -p "require('./product.json').nameLong"` + CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron" + else + NAME=`node -p "require('./product.json').applicationName"` + CODE=".build/electron/$NAME" + fi + + INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" + INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null` + # Node modules test -d node_modules || ./scripts/npm.sh install # Get electron - if [[ "$OSTYPE" == "darwin"* ]]; then - test -d .build/electron/Code\ -\ OSS.app || ./node_modules/.bin/gulp electron - else - test -d .build/electron/code-oss || ./node_modules/.bin/gulp electron - fi + (test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile - # Launch Code - [[ "$OSTYPE" == "darwin"* ]] \ - && ELECTRON=.build/electron/Code\ -\ OSS.app/Contents/MacOS/Electron \ - || ELECTRON=.build/electron/code-oss - - CLI="$ROOT/out/cli.js" - ELECTRON_RUN_AS_NODE=1 \ NODE_ENV=development \ VSCODE_DEV=1 \ ELECTRON_ENABLE_LOGGING=1 \ ELECTRON_ENABLE_STACK_DUMPING=1 \ - "$ELECTRON" --debug=5874 "$CLI" . "$@" + "$CODE" --debug=5874 "$ROOT/out/cli.js" . "$@" } code "$@" diff --git a/scripts/code.sh b/scripts/code.sh index 1e5b334f86f..fe3d014c633 100755 --- a/scripts/code.sh +++ b/scripts/code.sh @@ -18,11 +18,14 @@ function code() { CODE=".build/electron/$NAME" fi + INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" + INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null` + # Node modules test -d node_modules || ./scripts/npm.sh install # Get electron - test -f "$CODE" || ./node_modules/.bin/gulp electron + (test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile diff --git a/scripts/test.sh b/scripts/test.sh index 59bd5615b52..45eb9bb1fcc 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -18,11 +18,14 @@ else CODE=".build/electron/$NAME" fi +INTENDED_VERSION="v`node -p "require('./package.json').electronVersion"`" +INSTALLED_VERSION=`cat .build/electron/version 2> /dev/null` + # Node modules test -d node_modules || ./scripts/npm.sh install # Get electron -test -f "$CODE" || ./node_modules/.bin/gulp electron +(test -f "$CODE" && [ $INTENDED_VERSION == $INSTALLED_VERSION ]) || ./node_modules/.bin/gulp electron # Build test -d out || ./node_modules/.bin/gulp compile