diff --git a/source/nvda.pyw b/source/nvda.pyw index 5bf6d4380f1..6e4f4a0c1e6 100755 --- a/source/nvda.pyw +++ b/source/nvda.pyw @@ -6,16 +6,9 @@ """The NVDA launcher. It can handle some command-line arguments (including help). It sets up logging, and then starts the core.""" -import ctypes - -# #2729: Python's tempfile.get_default_tempdir() has a bug when handling multibyte paths. os.path.normcase is used incorrectly. -# Override this to use the temp path as returned by Windows. -import tempfile -tempPath = ctypes.create_string_buffer(260) -if ctypes.windll.kernel32.GetTempPathA(260, tempPath) > 0: - # Strip trailing backslash which is always included. - tempfile.tempdir = tempPath.value[:-1] +import pythonMonkeyPatches +import ctypes import os import sys import locale diff --git a/source/nvda_slave.pyw b/source/nvda_slave.pyw index 042dc8da637..5b6c273bb3f 100755 --- a/source/nvda_slave.pyw +++ b/source/nvda_slave.pyw @@ -2,6 +2,8 @@ Performs miscellaneous tasks which need to be performed in a separate process. """ +import pythonMonkeyPatches + import sys import os import logHandler diff --git a/source/pythonMonkeyPatches.py b/source/pythonMonkeyPatches.py new file mode 100644 index 00000000000..41f3996d576 --- /dev/null +++ b/source/pythonMonkeyPatches.py @@ -0,0 +1,15 @@ +#A part of NonVisual Desktop Access (NVDA) +#Copyright (C) 2006-2013 NVDA Contributors +#This file is covered by the GNU General Public License. +#See the file COPYING for more details. + +"""Fixes some broken features in Python such as gettempdir""" + +# #2729: Python's tempfile.get_default_tempdir() has a bug when handling multibyte paths. os.path.normcase is used incorrectly. +# Override this to use the temp path as returned by Windows. +import ctypes +import tempfile +tempPath = ctypes.create_string_buffer(260) +if ctypes.windll.kernel32.GetTempPathA(260, tempPath) > 0: + # Strip trailing backslash which is always included. + tempfile.tempdir = tempPath.value[:-1] diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index a991e88ee33..1cce4c4fb2d 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -47,6 +47,7 @@ - Text selection is now correctly shown on a braille display in applications such as Microsoft word 2003 and Internet Explorer edit controls. - It is again possible to select text in a backward direction in Microsoft Word while Braille is enabled. - When reviewing, backspacing or deleting characters In Scintilla edit controls, NVDA correctly announces multibyte characters. (#2855) +- NVDA will no longer fail to install when the user's profile path contains certain multibyte characters. (#2729) == Changes for Developers ==