diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index e6e910a..986a824 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -298,10 +298,13 @@ def metadata(args): con.close() -def copy_contents(src, dest): +def copy_recursive(src, dest): dest.mkdir(parents=True, exist_ok=True) for item in src.iterdir(): - shutil.copyfile(item, dest / item.name) + if item.is_dir() and not item.is_symlink(): + copy_recursive(item, dest / item.name) + else: + shutil.copyfile(item, dest / item.name) def generate(args): jenv = Environment( @@ -402,7 +405,7 @@ def generate(args): ) with resources.as_file(resources.files("dlibrary")) as r: - copy_contents(r / 'static', args.destdir / 'site' / 'static') + copy_recursive(r / 'static', args.destdir / 'site' / 'static') with open(args.destdir / 'site' / 'index.html', 'w') as f: f.write(list_template.render(depth=0, works=works))