Skip to content

Commit

Permalink
fix: fix the walk bug when cache is old
Browse files Browse the repository at this point in the history
  • Loading branch information
lianwenbo authored and windreamer committed Sep 28, 2017
1 parent 5756338 commit 23ae0a9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions dpark/file_manager/fs.py
Expand Up @@ -101,18 +101,16 @@ def walk(self, path, followlinks=False):
for name, info in cs.iteritems():
if name in '..':
continue
if info:
if info.ftype == TYPE_DIRECTORY:
if name not in dirs:
dirs.append(name)
elif info.ftype == TYPE_FILE:
if name not in files:
files.append(name)
elif info.ftype == TYPE_SYMLINK:
if os.path.isdir(os.path.join(root, name)):
dirs.append(name)
else:
files.append(name)
if info.ftype == TYPE_DIRECTORY:
dirs.append(name)
elif info.ftype == TYPE_FILE:
files.append(name)
else:
if os.path.isdir(os.path.join(root, name)):
dirs.append(name)
elif os.path.exists(os.path.join(path, name)):
files.append(name)

yield root, dirs, files
for d in sorted(dirs, reverse=True):
if not d.startswith('/'):
Expand Down

0 comments on commit 23ae0a9

Please sign in to comment.