From 61e280183891fe8c22941cc86c28eb4a5d3e45a6 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Thu, 12 May 2022 18:03:04 +0200
Subject: [PATCH] Windows fix

---
 lib/GHCup.hs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/GHCup.hs b/lib/GHCup.hs
index be7c681b..68c50eb9 100644
--- a/lib/GHCup.hs
+++ b/lib/GHCup.hs
@@ -324,13 +324,16 @@ installUnpackedGHC :: ( MonadReader env m
                    -> InstallDirResolved  -- ^ Path to install to
                    -> Version             -- ^ The GHC version
                    -> Excepts '[ProcessError] m ()
-installUnpackedGHC path (fromInstallDir -> inst) ver
+installUnpackedGHC path inst ver
   | isWindows = do
       lift $ logInfo "Installing GHC (this may take a while)"
       -- Windows bindists are relocatable and don't need
       -- to run configure.
       -- We also must make sure to preserve mtime to not confuse ghc-pkg.
-      lift $ withRunInIO $ \run -> flip onException (run $ recyclePathForcibly inst) $ copyDirectoryRecursive path inst $ \source dest -> do
+      lift $ withRunInIO $ \run -> flip onException (case inst of
+                                                      IsolateDirResolved _ -> pure ()
+                                                      GHCupDir d -> run $ recyclePathForcibly d
+                                                    ) $ copyDirectoryRecursive path (fromInstallDir inst) $ \source dest -> do
         mtime <- getModificationTime source
         moveFilePortable source dest
         setModificationTime dest mtime
@@ -345,7 +348,7 @@ installUnpackedGHC path (fromInstallDir -> inst) ver
 
       lift $ logInfo "Installing GHC (this may take a while)"
       lEM $ execLogged "sh"
-                       ("./configure" : ("--prefix=" <> inst)
+                       ("./configure" : ("--prefix=" <> fromInstallDir inst)
                         : alpineArgs
                        )
                        (Just path)
-- 
GitLab