Skip to content

Commit

Permalink
Windows: improve wording when running as admin fails (fix #169572)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Dec 21, 2022
1 parent c437ec2 commit cc696f4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/vs/platform/windows/electron-main/windowImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,15 @@ export class CodeWindow extends Disposable implements ICodeWindow {
title: this.productService.nameLong,
type: 'warning',
buttons: [
mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")),
this._config?.workspace ?
mnemonicButtonLabel(localize({ key: 'reopen', comment: ['&& denotes a mnemonic'] }, "&&Reopen")) :
mnemonicButtonLabel(localize({ key: 'newWindow', comment: ['&& denotes a mnemonic'] }, "&&New Window")),
mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))
],
message,
detail: localize('appGoneDetail', "We are sorry for the inconvenience. You can reopen the window to continue where you left off."),
detail: this._config?.workspace ?
localize('appGoneDetailWorkspace', "We are sorry for the inconvenience. You can reopen the window to continue where you left off.") :
localize('appGoneDetailEmptyWindow', "We are sorry for the inconvenience. You can open a new empty window to start again."),
noLink: true,
defaultId: 0,
checkboxLabel: this._config?.workspace ? localize('doNotRestoreEditors', "Don't restore editors") : undefined
Expand Down Expand Up @@ -816,18 +820,23 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}

// Inform user
await this.dialogMainService.showMessageBox({
const result = await this.dialogMainService.showMessageBox({
title: this.productService.nameLong,
type: 'error',
buttons: [
mnemonicButtonLabel(localize({ key: 'learnMore', comment: ['&& denotes a mnemonic'] }, "&&Learn More")),
mnemonicButtonLabel(localize({ key: 'close', comment: ['&& denotes a mnemonic'] }, "&&Close"))
],
message: localize('appGoneAdminMessage', "Running as administrator is not supported"),
detail: localize('appGoneAdminDetail', "Please try again without administrator privileges.", this.productService.nameLong),
message: localize('appGoneAdminMessage', "Running as administrator is not supported in your environment"),
detail: localize('appGoneAdminDetail', "We are sorry for the inconvenience. Please try again without administrator privileges.", this.productService.nameLong),
noLink: true,
defaultId: 0
}, this._win);

if (result.response === 0) {
await this.nativeHostMainService.openExternal(undefined, 'https://go.microsoft.com/fwlink/?linkid=2220179');
}

// Ensure to await flush telemetry
await Promise.all(appenders.map(appender => appender.flush()));

Expand Down

0 comments on commit cc696f4

Please sign in to comment.