def shortpath(self, path):
"""Returns the shortpath for a file.
As Python 2.7 does not support passing along unicode strings in
subprocess.Popen() and alike this will have to do. See also:
http://stackoverflow.com/questions/2595448/unicode-filename-to-python-subprocess-call
"""
KERNEL32.GetShortPathNameW.restype = c_uint
KERNEL32.GetShortPathNameW.argtypes = c_wchar_p, c_wchar_p, c_uint
buf = create_unicode_buffer(0x8000)
KERNEL32.GetShortPathNameW(path, buf, len(buf))
return buf.value
评论列表
文章目录