Remove some unnecessary checks and fix tests: UnicodeType isn't available in Python 3.2

This commit is contained in:
Elizaveta Shashkova
2016-04-26 16:35:54 +02:00
parent e5d58c6d1a
commit 32f3bdfd94
+9 -10
View File
@@ -82,16 +82,15 @@ except ImportError:
def convert_to_long_pathname(filename):
if sys.platform != "win32":
return filename
else:
if CTYPES_AVAILABLE:
buf = ctypes.create_unicode_buffer(260)
GetLongPathName = ctypes.windll.kernel32.GetLongPathNameW
rv = GetLongPathName(types.UnicodeType(filename), buf, 260)
if rv != 0 and rv <= 260:
return buf.value.encode(getfilesystemencoding())
return filename
if CTYPES_AVAILABLE:
buf = ctypes.create_unicode_buffer(260)
GetLongPathName = ctypes.windll.kernel32.GetLongPathNameW
if IS_PY2:
filename = unicode(filename)
rv = GetLongPathName(filename, buf, 260)
if rv != 0 and rv <= 260:
return buf.value.encode(getfilesystemencoding())
return filename
def norm_case(filename):