From 41694abbb650e236bd8080311787f435664dd0de Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Fri, 9 Feb 2024 13:26:35 -0700 Subject: Fix Setup to not crash when a symlink exists. --- .gitignore | 4 ++++ Setup.hs | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e45a2cb..58f1b4f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,7 @@ wtr_harness *.cabal *.lock */**/.cache + +# Not sure where these artifacts are coming from. +a.out +src/Main diff --git a/Setup.hs b/Setup.hs index 648d5a2..a7a3323 100644 --- a/Setup.hs +++ b/Setup.hs @@ -51,5 +51,10 @@ main = do lnF from to = do printf "%s -> %s\n" from to - flip when (removeLink to) =<< doesFileExist to + flip when (removeLink to) =<< doesExist to createSymbolicLink from to + + doesExist f = do + b1 <- doesFileExist f + b2 <- doesDirectoryExist f + return (b1 || b2) -- cgit