Fixed a bug causing wrong deprecation warnings or errors. (#14806)
Fix-up of #14350.
Summary of the issue:
Running NVDA 2023.1 (and older), with add-ons and/or scratchpad enabled:
I get the following deprecation warnings:
When opening start menu:
WARNING - appModuleHandler._warnDeprecatedAliasAppModule (15:49:46.531) - MainThread (19688):
Importing appModules.searchapp is deprecated, instead import appModules.searchui.
When switching to Notepad++:
WARNING - appModuleHandler._warnDeprecatedAliasAppModule (15:50:26.621) - MainThread (19688):
Importing appModules.notepad++ is deprecated, instead import appModules.notepadPlusPlus.
And if I force errors on deprecated code by modifying NVDAState._allowDeprecatedAPI to return False, I get errors instead.
This is not expected since these warnings/errors come from NVDA's core code which should not (and actually does not) contain deprecated code.
Description of user facing changes
No more wrong deprecation warnings/errors due to NVDA's core appModules when opening start menu or switching to Notepad++
Description of development approach
appModules.__path__ contains the paths where NVDA has to search appModules. It contains first the folder in the scratchpad, then the folders in add-on containing appModules and finally the core appModule folder. Thus we need to look at the last element of appModules.__path__, not the first as it was done.