Query about the exact length of a short name, as it may happen that

a short name length is actually greater than the long name length.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38908 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2011-06-01 01:51:17 +00:00
parent ef51dbff8e
commit bd9d3cb0eb

View File

@ -105,8 +105,9 @@ def checkTeXPaths():
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):
shortlen = GetShortPathName(longname, 0, 0)
shortname = create_unicode_buffer(shortlen)
if GetShortPathName(longname, shortname, shortlen):
inpname = shortname.value.replace('\\', '/')
else:
inpname = tmpfname.replace('\\', '/')