Fixed asset rm

This commit is contained in:
Jim Shepich III 2026-02-04 12:47:58 -05:00
parent 167fea0a2c
commit 90ffc019d2

View File

@ -60,6 +60,9 @@ def copy_assets(site: SiteConfig) -> None:
destination = f'{site.web_root}/{asset.removeprefix(site.build_cache).lstrip("/")}'
# Delete existing files.
if os.path.isfile(destination):
os.remove(destination)
elif os.path.isdir(destination):
shutil.rmtree(destination, ignore_errors=True)
# Copy the asset.
@ -74,6 +77,9 @@ def copy_assets(site: SiteConfig) -> None:
# level of the filetree than the included assets, remove them.
for asset in ignored_asset_list:
destination = f'{site.web_root}/{asset.removeprefix(site.build_cache).lstrip("/")}'
if os.path.isfile(destination):
os.remove(destination)
elif os.path.isdir(destination):
shutil.rmtree(destination, ignore_errors=True)