kopia lustrzana https://github.com/micropython/micropython-lib
os: Update walk() to use ilistdir().
rodzic
07da5583d5
commit
1c5936e19e
|
@ -142,14 +142,14 @@ def listdir(path="."):
|
||||||
def walk(top, topdown=True):
|
def walk(top, topdown=True):
|
||||||
files = []
|
files = []
|
||||||
dirs = []
|
dirs = []
|
||||||
for dirent in ilistdir_ex(top):
|
for dirent in ilistdir(top):
|
||||||
mode = dirent[3] << 12
|
mode = dirent[1] << 12
|
||||||
fname = dirent[4].split(b'\0', 1)[0]
|
fname = fsdecode(dirent[0])
|
||||||
if stat_.S_ISDIR(mode):
|
if stat_.S_ISDIR(mode):
|
||||||
if fname != b"." and fname != b"..":
|
if fname != "." and fname != "..":
|
||||||
dirs.append(fsdecode(fname))
|
dirs.append(fname)
|
||||||
else:
|
else:
|
||||||
files.append(fsdecode(fname))
|
files.append(fname)
|
||||||
if topdown:
|
if topdown:
|
||||||
yield top, dirs, files
|
yield top, dirs, files
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
|
|
Ładowanie…
Reference in New Issue