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