Skip to content

Commit

Permalink
NVDA no longer fails to install if the user's profile path contains c…
Browse files Browse the repository at this point in the history
…ertain multibyte characters. Another fix for #2729. Instead of monkeypatching Python's tempfile module only in nvda.pyw, moe this code in to a new pythonMonkeyPatches module and import it (apply them) from both nvda.pyw and nvda_slave.pyw.
  • Loading branch information
michaelDCurran committed Feb 1, 2013
1 parent c790f84 commit c0c5b69
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
11 changes: 2 additions & 9 deletions source/nvda.pyw
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions source/nvda_slave.pyw
Expand Up @@ -2,6 +2,8 @@
Performs miscellaneous tasks which need to be performed in a separate process.
"""

import pythonMonkeyPatches

import sys
import os
import logHandler
Expand Down
15 changes: 15 additions & 0 deletions source/pythonMonkeyPatches.py
@@ -0,0 +1,15 @@
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2013 NVDA Contributors <http://www.nvda-project.org/>
#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]
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Expand Up @@ -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 ==
Expand Down

0 comments on commit c0c5b69

Please sign in to comment.