From 90ffc019d265de653d57b1f710f671fbfbdbcd69 Mon Sep 17 00:00:00 2001 From: Jim Shepich III Date: Wed, 4 Feb 2026 12:47:58 -0500 Subject: [PATCH] Fixed asset rm --- jimsite/assets.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jimsite/assets.py b/jimsite/assets.py index 78d05f2..0522914 100644 --- a/jimsite/assets.py +++ b/jimsite/assets.py @@ -60,7 +60,10 @@ def copy_assets(site: SiteConfig) -> None: destination = f'{site.web_root}/{asset.removeprefix(site.build_cache).lstrip("/")}' # 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. 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. for asset in ignored_asset_list: 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 \ No newline at end of file