提交 82549ec7 编写于 作者: J Joao Moreno

Merge commit 'refs/pull/46962/head' of github.com:Microsoft/vscode into pr/46962

...@@ -78,8 +78,7 @@ class InstallAction extends Action { ...@@ -78,8 +78,7 @@ class InstallAction extends Action {
return createSymlink().then(null, err => { return createSymlink().then(null, err => {
if (err.code === 'EACCES' || err.code === 'ENOENT') { if (err.code === 'EACCES' || err.code === 'ENOENT') {
return this.createBinFolder() return this.createBinFolderAndSymlink();
.then(() => createSymlink());
} }
return TPromise.wrapError(err); return TPromise.wrapError(err);
...@@ -101,14 +100,14 @@ class InstallAction extends Action { ...@@ -101,14 +100,14 @@ class InstallAction extends Action {
.then(null, ignore('ENOENT', false)); .then(null, ignore('ENOENT', false));
} }
private createBinFolder(): TPromise<void> { private createBinFolderAndSymlink(): TPromise<void> {
return new TPromise<void>((c, e) => { return new TPromise<void>((c, e) => {
const buttons = [nls.localize('ok', "OK"), nls.localize('cancel2', "Cancel")]; const buttons = [nls.localize('ok', "OK"), nls.localize('cancel2', "Cancel")];
this.dialogService.show(Severity.Info, nls.localize('warnEscalation', "Code will now prompt with 'osascript' for Administrator privileges to install the shell command."), buttons, { cancelId: 1 }).then(choice => { this.dialogService.show(Severity.Info, nls.localize('warnEscalation', "Code will now prompt with 'osascript' for Administrator privileges to install the shell command."), buttons, { cancelId: 1 }).then(choice => {
switch (choice) { switch (choice) {
case 0 /* OK */: case 0 /* OK */:
const command = 'osascript -e "do shell script \\"mkdir -p /usr/local/bin && chown \\" & (do shell script (\\"whoami\\")) & \\" /usr/local/bin\\" with administrator privileges"'; const command = 'osascript -e "do shell script \\"mkdir -p /usr/local/bin && ln -sf \'' + getSource() + '\' \'' + this.target + '\'\\" with administrator privileges"';
nfcall(cp.exec, command, {}) nfcall(cp.exec, command, {})
.then(null, _ => TPromise.wrapError(new Error(nls.localize('cantCreateBinFolder', "Unable to create '/usr/local/bin'.")))) .then(null, _ => TPromise.wrapError(new Error(nls.localize('cantCreateBinFolder', "Unable to create '/usr/local/bin'."))))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册