def dos_to_long(path):
 if (not ((os.name == 'nt') and ('~' in path) and os.path.exists(path))):
  return path
 from ctypes import create_unicode_buffer, windll
 buf = create_unicode_buffer(500)
 windll.kernel32.GetLongPathNameW(path.decode('mbcs'), buf, 500)
 return buf.value.encode('mbcs')

def dos_to_long ( path ) : if ( not ( ( os . name == 'nt' ) and ( '~' in path ) and os . path . exists ( path ) ) ) : return path from ctypes import create_unicode_buffer , windll buf = create_unicode_buffer ( 500 ) windll . kernel32 . GetLongPathNameW ( path . decode ( 'mbcs' ) , buf , 500 ) return buf . value . encode ( 'mbcs' )
convert windows paths in dos format to long format .