From e6d9313334024d5fe9556adc0fe4884813e13a03 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 18 Feb 2025 18:08:40 -0600 Subject: [PATCH] it might not exist yet --- home/private_bin/executable_mkscratch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home/private_bin/executable_mkscratch b/home/private_bin/executable_mkscratch index 2ecac90..1e5bbbd 100644 --- a/home/private_bin/executable_mkscratch +++ b/home/private_bin/executable_mkscratch @@ -7,9 +7,9 @@ from tempfile import mkdtemp SCRATCH_DIR = Path.home() / "scratch" WEEK_SCRATCH = SCRATCH_DIR / datetime.now().strftime("%Y/%U") - -(SCRATCH_DIR / "current").unlink() -(SCRATCH_DIR / "current").symlink_to(WEEK_SCRATCH) +if (SCRATCH_CURRENT := SCRATCH_DIR / "current").is_dir(): + SCRATCH_CURRENT.unlink() +SCRATCH_CURRENT.symlink_to(WEEK_SCRATCH) def scratch_maintenance():