-
-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow NVDA to still function if a component changes the current directory #11650
Conversation
… made absolute as soon as possible to protect against the current directory changing later on. Also store NVDA's app dir in globalVars.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There are indeed some places where NVDA expects current directory to be its install dir which you've missed:
Please also grep for places in which we call |
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.
Two more cases of relative path's are |
Sorry one more - path to builtin.dic in speechDictHandler is also relative. |
…n places where we can't be completely sure the path is absolute.
from logHandler import log | ||
from ctypes import windll | ||
from ctypes import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
windll
is the only part of ctypes
used in this file - this line can be removed.
source/nvda_slave.pyw
Outdated
h = ctypes.windll.kernel32.LoadLibraryExW( | ||
os.path.join(globalVars.appDir, "lib", versionInfo.version, "nvdaHelperRemote.dll"), | ||
0, | ||
0x8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this a named constant in winKernel and use it both here and in NVDAHelper.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…in NVDAHelper and nvda_slave when loading NvDAHelperRemote.
7e76868
to
3c0f741
Compare
This comment has been minimized.
This comment has been minimized.
Do you plan to merge this fairly quickly? (i.e. does it make sense to change #11639 so it uses |
@codeofdusk This pr may take a little time to be carefully reviewed I think. |
OK, I'll leave #11639 as-is (to avoid unnecessary delay) but we should make a note to adjust the nvda_dmp invocation to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me @michaelDCurran
Hi, I'm afraid this PR introduced startup regression - the resulting alpha build isn't even starting at all, or if it did, instlal screen or UAC (in case of an update) isn't showing. Thanks. |
Most likely nvdaRemote. I am investigating why this is the case right now.
@josephsl can you confirm that if you do have NVDARemote installed,
disabling / removing allows NVDA to start again? or is it other add-ons
as well.
|
I have temporarily reset master to the commit before this merge while we work out why this causes an incompatibility with NVDARemote and thus stops NVDA from starting. |
NVDA is stuck in a while loop.
|
…g them to stop an infinite while loop introduced in #11650
in addonHandler.getCodeAdon: we walk back up to the root-most directory of an addon, but we need to normalize the paths with os.path.normpath before comparing them. Previously os.path.abspath did this for us. |
Leaving master reset back to the commit before this (I.e. this pr has been reverted). I shall open a new pr containing all the current changes plus the fix. |
…tory (#11707) * nvda.pyw: ensure that all paths coming from commandline arguments are made absolute as soon as possible to protect against the current directory changing later on. Also store NVDA's app dir in globalVars. * Use the NVDA app dir rather than the current directory for relative paths. * Fix unit tests. * Remove all usage of os.getcwd and replace it with globalVars.appDir * Replace all remaining os.path.join("* calls with os.path.join(globalVars.appDir calls. * nvda.pyw: provide an absolute path to gettext.translate * nvda_slave: set globalVars.appDir, and provide an absolute path to gettext.translate * getDefaultLogFilePath no longer uses the current directory. * brailleTables: TABLES_DIR is no longer relative to the current directory. * ui.browsableMessage no longer uses a relative path to get to the html file. * Change all playWavefile calls to be non-relative * Fix linting issues * another relative wave file path * Fix linting issues * speechDictHandler: the path to builtin.dic is no longer relative. * config: slave_fileName is no longer relative * Lilli braille driver: path to dll is no longer relative. * Fix linting issues * nvda_slave: don't load nvdaRemote with a relative path. * Remove all usage of os.path.abspath, but add a couple of assertions in places where we can't be completely sure the path is absolute. * Fix translation comments * Add the ALTERED_LIBRARY_SEARCH_PATH constant to winKernel and use it in NVDAHelper and nvda_slave when loading NvDAHelperRemote. * Lili braille dirver: remove unneeded import. * Update what's new * addonHandler.getCodeAddon: make sure to normalize paths when comparing them to stop an infinite while loop introduced in #11650
Link to issue number:
Fixes #6491
Summary of the issue:
When testing the Ivona SAPI5 demo voices for another issue from https://www.harposoftware.com/ I noticed that once loading one of these voices:
All of this is caused by the fact that this SAPI5 engine very inappropriately changes the current directory to its own directory when the voice is loaded, and never changes it back.
Many parts of NVDA assume that the current directory is set to NVDA's application directory, and therefore all relative paths (and there are many of them) depend on the current directory.
As much as this engine is behaving very badly, we should at very least make sure that NVDA does not become unusable. I.e. config should still be able to be saved, symbols (and therefore speech) should still work, and switching back to another synthesizer should also work.
Description of how this pull request fixes the issue:
It is possible that some paths have been missed, but with these changes and running SAPI5 Ivona it is certainly now possible to:
Testing performed:
See the three points above.
Known issues with pull request:
None
Change log entry: