Make windows mergeFileTree more robust

This commit is contained in:
Julian Ospald 2022-05-21 20:51:13 +02:00
parent 68c81577a4
commit c56b9ec3ce
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
1 changed files with 5 additions and 4 deletions

View File

@ -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