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
This commit is contained in:
Enrico Forestieri 2011-05-31 01:12:27 +00:00
parent 7920909ca5
commit 226b29943f

View File

@ -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'))