From c56b9ec3ce2912406a063fd0db0dbdebf9f45824 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 21 May 2022 20:51:13 +0200 Subject: [PATCH] Make windows mergeFileTree more robust --- lib/GHCup.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/GHCup.hs b/lib/GHCup.hs index d8b2a5c..60a963f 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -328,10 +328,11 @@ installUnpackedGHC path inst ver forceInstall -- Windows bindists are relocatable and don't need -- to run configure. -- We also must make sure to preserve mtime to not confuse ghc-pkg. - liftE $ mergeFileTree path inst GHC (mkTVer ver) $ \source dest -> liftIO $ do - mtime <- ifM (pathIsSymbolicLink source) (pure Nothing) (Just <$> getModificationTime source) - moveFilePortable source dest - forM_ mtime $ setModificationTime dest + liftE $ mergeFileTree path inst GHC (mkTVer ver) $ \source dest -> do + mtime <- liftIO $ ifM (pathIsSymbolicLink source) (pure Nothing) (Just <$> getModificationTime source) + when forceInstall $ hideError doesNotExistErrorType $ hideError InappropriateType $ recycleFile dest + liftIO $ moveFilePortable source dest + forM_ mtime $ liftIO . setModificationTime dest | otherwise = do PlatformRequest {..} <- lift getPlatformReq