Skip to content

Catch exceptions when creating shortcuts#10875

Merged
feerrenrut merged 3 commits into
masterfrom
makeCreateShortcutMoreRobust
Mar 17, 2020
Merged

Catch exceptions when creating shortcuts#10875
feerrenrut merged 3 commits into
masterfrom
makeCreateShortcutMoreRobust

Conversation

@feerrenrut

@feerrenrut feerrenrut commented Mar 13, 2020

Copy link
Copy Markdown
Contributor

Link to issue number:

fixes #5166
fixes #6326

Related, alternative approach: #10874

Summary of the issue:

The way that shortcuts are created (wsh) does not handle unicode characters. This results in the installer presenting an error.

Description of how this pull request fixes the issue:

Wrap each call to create shortcut in a try block, on error try to create the shortcut without translation.

Testing performed:

Manually replaced translated versions of the strings with unicode characters (including the hotkey).
Checked that an error is presented in the log, but the shortcut is still created.

Known issues with pull request:

  • When an error occurs the shortcuts / hotkey will not be translated.

Change log entry:

Section: New features, Changes, Bug fixes

Wrap each call to create shortcut in a try block, on error
try to create the shortcut without translation.
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 0eba1aeb93

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of flake8 errors at the moment also.

Comment thread source/installer.py Outdated
registerAddonFileAssociation(slaveExe)


def _updateShotcuts(NVDAExe, installDir, shouldCreateDesktopShortcut, slaveExe, startMenuFolder) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename _updateShotcuts to _updateShortcuts please.

Flake8 was complaining about the code complexity, which I agreed with
and could not bring myself to make flake8 ignore the function.
@feerrenrut

Copy link
Copy Markdown
Contributor Author

Since the linter was complaining about the complexity of the function, and I agree it was hard to read, I have re-worked it. The new function wraps the calls to create shortcut, falling back on the non-translated name / hotkey as necessary.

@feerrenrut feerrenrut merged commit 2ecd013 into master Mar 17, 2020
@feerrenrut feerrenrut deleted the makeCreateShortcutMoreRobust branch March 17, 2020 06:50
feerrenrut added a commit that referenced this pull request Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants