Skip to content

Commit

Permalink
Include the Linux bin command in the main dir
Browse files Browse the repository at this point in the history
This also changes the behavior of the bin command to find cli.js relatively,
meaning the CLI now supports non-standard install locations.
  • Loading branch information
Tyriar committed Apr 5, 2016
1 parent 117b3eb commit cd12a7e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
16 changes: 6 additions & 10 deletions build/gulpfile.vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ function packageTask(platform, arch, opts) {
result = es.merge(result, gulp.src('resources/win32/bin/code.sh', { base: 'resources/win32' })
.pipe(replace('@@NAME@@', product.nameShort))
.pipe(rename(function (f) { f.basename = product.applicationName; f.extname = ''; })));
} else if (platform === 'linux') {
result = es.merge(result, gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(rename('bin/' + product.applicationName)));
}

return result.pipe(symdest(destination));
Expand All @@ -259,10 +263,6 @@ function prepareDebPackage(arch) {
var packageRevision = getEpochTime();

return function () {
var shortcut = gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(rename('usr/share/' + product.applicationName + '/bin/' + product.applicationName));

var desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
Expand Down Expand Up @@ -299,7 +299,7 @@ function prepareDebPackage(arch) {
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
.pipe(rename('DEBIAN/postinst'))

var all = es.merge(control, postinst, prerm, desktop, icon, shortcut, code);
var all = es.merge(control, postinst, prerm, desktop, icon, code);

return all.pipe(symdest(destination));
};
Expand Down Expand Up @@ -335,10 +335,6 @@ function prepareRpmPackage(arch) {
var packageRevision = getEpochTime();

return function () {
var shortcut = gulp.src('resources/linux/bin/code.sh', { base: '.' })
.pipe(replace('@@NAME@@', product.applicationName))
.pipe(rename('BUILD/usr/share/' + product.applicationName + '/bin/' + product.applicationName));

var desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
.pipe(replace('@@NAME_LONG@@', product.nameLong))
.pipe(replace('@@NAME@@', product.applicationName))
Expand All @@ -363,7 +359,7 @@ function prepareRpmPackage(arch) {
var specIcon = gulp.src('resources/linux/rpm/code.xpm', { base: '.' })
.pipe(rename('SOURCES/' + product.applicationName + '.xpm'));

var all = es.merge(code, desktop, icon, shortcut, spec, specIcon);
var all = es.merge(code, desktop, icon, spec, specIcon);

return all.pipe(symdest(destination));
}
Expand Down
18 changes: 14 additions & 4 deletions resources/linux/bin/code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.

NAME="@@NAME@@"
VSCODE_PATH="/usr/share/$NAME"
ELECTRON="$VSCODE_PATH/$NAME"
if [ ! -L $0 ]; then
# if path is not a symlink, find relatively
VSCODE_PATH="$(dirname $0)/.."
else
if which readlink >/dev/null; then
# if readlink exists, follow the symlink and find relatively
VSCODE_PATH="$(dirname $(readlink $0))/.."
else
# else use the standard install location
VSCODE_PATH="/usr/share/@@NAME@@"
fi
fi
ELECTRON="$VSCODE_PATH/@@NAME@@"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
exit $?
exit $?
1 change: 0 additions & 1 deletion resources/linux/rpm/code.spec.template
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@ ln -s /usr/share/@@NAME@@/bin/@@NAME@@ /usr/bin/@@NAME@@
%defattr(-,root,root)

/usr/share/@@NAME@@/
/usr/share/@@NAME@@/bin/@@NAME@@
/usr/share/applications/@@NAME@@.desktop
/usr/share/pixmaps/@@NAME@@.png

0 comments on commit cd12a7e

Please sign in to comment.