]> git.lyx.org Git - features.git/blobdiff - lib/configure.py
On Windows, properly account for the encoding of the temporary directory.
[features.git] / lib / configure.py
index ae987ef63f108be3b5cb66543f104acfa90e712d..f88d51966ac1d5b3f234c05c8a19d56298d7805e 100644 (file)
@@ -109,9 +109,13 @@ def checkTeXPaths():
         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):