Skip to content

Commit

Permalink
Fix up recursive_dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
jtv committed May 2, 2024
1 parent 24fca28 commit 178ad8f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ def recursive_dir(path, relative_to):
relative_to = os.path.normpath(relative_to)
files = []
for dirpath, _, filenames in os.walk(path):
if dirpath == path:
reldir = ''
else:
reldir = os.path.relpath(dirpath, relative_to)
for filename in sorted(filenames):
local = os.path.samefile(dirpath, relative_to)
reldir = os.path.relpath(dirpath, relative_to)
for filename in filenames:
filename = os.path.normpath(filename)
if not filename.startswith('.'):
files.append(os.path.join(reldir, filename))
if local:
relative = filename
else:
relative = os.path.join(reldir, filename)
files.append(relative)
return files


Expand Down

0 comments on commit 178ad8f

Please sign in to comment.