1178
1179
pending.extend(d for d in reversed(dirblock) if d[2] == _directory)
1182
_real_walkdirs_utf8 = None
1181
1184
def _walkdirs_utf8(top, prefix=""):
1182
1185
"""Yield data about all the directories in a tree.
1192
1195
path-from-top might be unicode or utf8, but it is the correct path to
1193
1196
pass to os functions to affect the file in question. (such as os.lstat)
1195
fs_encoding = _fs_enc.upper()
1196
if (sys.platform == 'win32' or
1197
fs_encoding not in ('UTF-8', 'US-ASCII', 'ANSI_X3.4-1968')): # ascii
1198
return _walkdirs_unicode_to_utf8(top, prefix=prefix)
1200
return _walkdirs_fs_utf8(top, prefix=prefix)
1198
global _real_walkdirs_utf8
1199
if _real_walkdirs_utf8 is None:
1200
fs_encoding = _fs_enc.upper()
1201
if win32utils.winver == 'Windows NT':
1202
# Win98 doesn't have unicode apis like FindFirstFileW
1203
# TODO: We possibly could support Win98 by falling back to the
1204
# original FindFirstFile, and using TCHAR instead of WCHAR,
1205
# but that gets a bit tricky, and requires custom compiling
1208
from bzrlib._walkdirs_win32 import _walkdirs_utf8_win32_find_file
1210
_real_walkdirs_utf8 = _walkdirs_unicode_to_utf8
1212
_real_walkdirs_utf8 = _walkdirs_utf8_win32_find_file
1213
elif fs_encoding not in ('UTF-8', 'US-ASCII', 'ANSI_X3.4-1968'):
1214
# ANSI_X3.4-1968 is a form of ASCII
1215
_real_walkdirs_utf8 = _walkdirs_unicode_to_utf8
1217
_real_walkdirs_utf8 = _walkdirs_fs_utf8
1218
return _real_walkdirs_utf8(top, prefix=prefix)
1203
1221
def _walkdirs_fs_utf8(top, prefix=""):