mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 15:28:28 +01:00
Fix unicode() issue for python3
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
||||
import ctypes
|
||||
import os
|
||||
import re
|
||||
from builtins import str
|
||||
|
||||
if os.name == 'nt':
|
||||
from ctypes import create_unicode_buffer, windll
|
||||
@@ -85,7 +86,7 @@ class System(object):
|
||||
|
||||
buffer = create_unicode_buffer(System.LONG_PATH_BUFFER_SIZE)
|
||||
get_long_path_name = windll.kernel32.GetLongPathNameW
|
||||
result = get_long_path_name(unicode(path), buffer, System.LONG_PATH_BUFFER_SIZE)
|
||||
result = get_long_path_name(u'%s' % str(path), buffer, System.LONG_PATH_BUFFER_SIZE)
|
||||
if result == 0 or result > System.LONG_PATH_BUFFER_SIZE:
|
||||
return path
|
||||
return buffer.value
|
||||
|
||||
Reference in New Issue
Block a user