Author: forenr
Date: Mon Mar  5 18:14:09 2012
New Revision: 40858
URL: http://www.lyx.org/trac/changeset/40858

Log:
On Windows, properly account for the encoding of the temporary directory.

Modified:
   lyx-devel/trunk/lib/configure.py

Modified: lyx-devel/trunk/lib/configure.py
==============================================================================
--- lyx-devel/trunk/lib/configure.py    Mon Mar  5 02:51:19 2012        (r40857)
+++ lyx-devel/trunk/lib/configure.py    Mon Mar  5 18:14:09 2012        (r40858)
@@ -109,9 +109,13 @@
         from tempfile import mkstemp
         fd, tmpfname = mkstemp(suffix='.ltx')
         if os.name == 'nt':
+            from locale import getdefaultlocale
             from ctypes import windll, create_unicode_buffer
             GetShortPathName = windll.kernel32.GetShortPathNameW
-            longname = unicode(tmpfname)
+            language, encoding = getdefaultlocale()
+            if encoding == None:
+                encoding = 'latin1'
+            longname = unicode(tmpfname, encoding)
             shortlen = GetShortPathName(longname, 0, 0)
             shortname = create_unicode_buffer(shortlen)
             if GetShortPathName(longname, shortname, shortlen):

Reply via email to