From 63350dab71ce402f4d89b8e6db9dc47a03a495f2 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Sun, 6 Feb 2022 22:56:22 +0100
Subject: [PATCH] Fix recyclePathForcibly on windows

---
 lib/GHCup/Utils/Prelude.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/GHCup/Utils/Prelude.hs b/lib/GHCup/Utils/Prelude.hs
index 473652b0..21b7173e 100644
--- a/lib/GHCup/Utils/Prelude.hs
+++ b/lib/GHCup/Utils/Prelude.hs
@@ -472,7 +472,9 @@ recyclePathForcibly fp
       let dest = tmp </> takeFileName fp
       liftIO (moveFile fp dest)
           `catch`
-          (\e -> if isPermissionError e {- EXDEV on windows -} then recover (liftIO $ removePathForcibly fp) else throwIO e)
+          (\e -> if | isDoesNotExistError e -> pure ()
+                    | isPermissionError e {- EXDEV on windows -} -> recover (liftIO $ removePathForcibly fp)
+                    | otherwise -> throwIO e)
           `finally`
             liftIO (handleIO (\_ -> pure ()) $ removePathForcibly tmp)
   | otherwise = liftIO $ removePathForcibly fp
-- 
GitLab