From 226b29943fde1e25248981d07c88ceed7a1feb73 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 31 May 2011 01:12:27 +0000 Subject: [PATCH] On Windows, avoid spaces in filenames passed to latex by using the short form of the path. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38894 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/configure.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/configure.py b/lib/configure.py index b376d5029d..7b76d69d67 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -102,7 +102,14 @@ def checkTeXPaths(): from tempfile import mkstemp fd, tmpfname = mkstemp(suffix='.ltx') if os.name == 'nt': - inpname = tmpfname.replace('\\', '/') + from ctypes import windll, create_unicode_buffer + GetShortPathName = windll.kernel32.GetShortPathNameW + longname = unicode(tmpfname) + shortname = create_unicode_buffer(len(longname)+1) + if GetShortPathName(longname, shortname, len(longname)+1): + inpname = shortname.value.replace('\\', '/') + else: + inpname = tmpfname.replace('\\', '/') else: inpname = cmdOutput('cygpath -m ' + tmpfname) logname = os.path.basename(inpname.replace('.ltx', '.log'))