Added a condition that checks if a addon directory is empty when loading it initially.#9372
Conversation
|
I don't understand why the test build fails. Can someone help me out with this and suggest better changes ? |
|
The failing tests aren't caused by your code. This will be dealt with in another ^pr.
|
|
Hi, no, it has nothing to do with our pull requests – it has to do with dependencies (there is a pull request to rectify this). Thanks.
|
|
Alright, thanks for the quick replies guys, this is my first pull request so I thought I might've made a mistake. |
|
Because this issue is indicative of a broader error state, we should not merely hide this situation. I would recommend adding a log message at the error level to warn the user / developer that this has occurred. NVDA should then be able to continue, excluding this addon. |
|
Got it i'll try adding that in. Can someone tell me how to access the access to the log file works in NVDA. Can I just use a |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There are lots of examples in the file you are editing. For instance the line after your edit is: Essentially, you can call |
|
Can you check if this is alright ? @feerrenrut |
feerrenrut
left a comment
There was a problem hiding this comment.
Looks like you are on the right track. A few suggestions here, after you have made these changes and tested again, could you also please update the testing performed section to show the steps you took to test this and how you verified that the result was correct.
| except: | ||
| log.error("Error loading Addon from path: %s", addon_path, exc_info=True) | ||
| else: | ||
| log.error("Error loading Addon from path: %s, try reinstalling: %s", addon_path, name,exc_info=True) |
There was a problem hiding this comment.
I don't think there is an exception active at this stage, I dont think the parameter exc_info is necessary. As mentioned in the other comment, I think it would improve the readability if this block was moved under the if statement.
I haven't yet tried this out, is it true that reinstalling will work?
There was a problem hiding this comment.
Yes reinstalling works. What happens when you delete all the files is that the addon disappears from the addon list and you have to reinstall it. And I have changed the if condition around as you have suggested.
There was a problem hiding this comment.
Thanks @awalvie. Could you please update the "testing performed" section of the initial description of this PR. Please see our wiki page explaining the PR template for further information and examples on this
There was a problem hiding this comment.
Any other changes you'd recommend making ?
There was a problem hiding this comment.
Nope, just waiting on the changes to the "testing performed" section of the initial description of this PR. Don't forget to read the wiki page.
There was a problem hiding this comment.
Really sorry, forgot about it. I'll do this ASAP
There was a problem hiding this comment.
@feerrenrut Just updated it. Let me know if any other changes need to be done. Thanks for the feedback.
feerrenrut
left a comment
There was a problem hiding this comment.
I'll merge this in. Thanks for your work on this.
No longer crash when an addon directory is empty.
|
Thanks for all the help and suggestions. |
Link to issue number:
Fixes #7686
Summary of the issue:
Currently NVDA's addonHandler only checks whether an addon directory exists or not, if it does, then it tries to load the addon from the directory. The issue arises when files are manually deleted from a Addon folder except from the folder itself. As the addon still has a directory it's empty and hence does not contain the necessary files, which throws an error that stop NVDA from starting.
Original Issue
Description of how this pull request fixes the issue:
As suggested in the issue conversation I am just checking if the addon directory has any files inside it.
Testing performed:
(Exptected)
NVDA Fails to start as the addon directory has no files.
(After Fix)
NVDA Does indeed restart with a
log.error()specifying that the addon at the following location could not be loaded.Known issues with pull request:
It fixes the issue but dose not inform the user that the addon has been deleted
Section: Bug fixes