Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pyfs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pyfs
Commits
64e80d49
Commit
64e80d49
authored
Dec 20, 2010
by
willmcgugan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added graceful handling of the directory structure changing during a 'walk'.
parent
0bd14855
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
fs/base.py
+20
-12
No files found.
fs/base.py
View file @
64e80d49
...
@@ -712,23 +712,31 @@ class FS(object):
...
@@ -712,23 +712,31 @@ class FS(object):
while
dirs
:
while
dirs
:
current_path
=
dirs
.
pop
()
current_path
=
dirs
.
pop
()
paths
=
[]
paths
=
[]
for
filename
in
listdir
(
current_path
):
try
:
path
=
pathjoin
(
current_path
,
filename
)
for
filename
in
listdir
(
current_path
):
if
self
.
isdir
(
path
):
path
=
pathjoin
(
current_path
,
filename
)
if
dir_wildcard
(
path
):
if
self
.
isdir
(
path
):
dirs
.
append
(
path
)
if
dir_wildcard
(
path
):
else
:
dirs
.
append
(
path
)
if
wildcard
(
filename
):
else
:
paths
.
append
(
filename
)
if
wildcard
(
filename
):
paths
.
append
(
filename
)
except
ResourceNotFoundError
:
# Could happen if another thread / process deletes something whilst we are walking
pass
yield
(
current_path
,
paths
)
yield
(
current_path
,
paths
)
elif
search
==
"depth"
:
elif
search
==
"depth"
:
def
recurse
(
recurse_path
):
def
recurse
(
recurse_path
):
for
path
in
listdir
(
recurse_path
,
wildcard
=
dir_wildcard
,
full
=
True
,
dirs_only
=
True
):
try
:
for
p
in
recurse
(
path
):
for
path
in
listdir
(
recurse_path
,
wildcard
=
dir_wildcard
,
full
=
True
,
dirs_only
=
True
):
yield
p
for
p
in
recurse
(
path
):
yield
p
except
ResourceNotFoundError
:
# Could happen if another thread / process deletes something whilst we are walking
pass
yield
(
recurse_path
,
self
.
listdir
(
recurse_path
,
wildcard
=
wildcard
,
files_only
=
True
))
yield
(
recurse_path
,
self
.
listdir
(
recurse_path
,
wildcard
=
wildcard
,
files_only
=
True
))
for
p
in
recurse
(
path
):
for
p
in
recurse
(
path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment