Unlink Path object instead of Shred*, oops

This commit is contained in:
Darryl Nixon 2023-07-16 11:39:16 -07:00
parent dacc4a89c7
commit 67570a4368

View file

@ -84,7 +84,7 @@ class ShredFile(AsyncObject):
"""Class for tracking each file to be shredded.""" """Class for tracking each file to be shredded."""
async def __init__(self, path: Path) -> None: async def __init__(self, path: Path) -> None:
self.absolute_path = path.resolve() self.absolute_path = path.resolve().absolute()
self.byte_size = path.stat().st_size self.byte_size = path.stat().st_size
self.mount_point = find_mount(self.absolute_path) self.mount_point = find_mount(self.absolute_path)
self.fs_handler = await mount_to_fs_handler(self.mount_point) self.fs_handler = await mount_to_fs_handler(self.mount_point)
@ -137,7 +137,7 @@ class ShredFile(AsyncObject):
# Remove the file # Remove the file
log_buf = f"[4/4] Unlinking {self.absolute_path}" log_buf = f"[4/4] Unlinking {self.absolute_path}"
if not dryrun: if not dryrun:
await file.unlink() self.absolute_path.unlink()
else: else:
log_buf = "DRY RUN (no changes made) " + log_buf log_buf = "DRY RUN (no changes made) " + log_buf
logger.info(log_buf) logger.info(log_buf)