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

View File

@ -328,10 +328,11 @@ installUnpackedGHC path inst ver forceInstall
-- Windows bindists are relocatable and don't need -- Windows bindists are relocatable and don't need
-- to run configure. -- to run configure.
-- We also must make sure to preserve mtime to not confuse ghc-pkg. -- We also must make sure to preserve mtime to not confuse ghc-pkg.
liftE $ mergeFileTree path inst GHC (mkTVer ver) $ \source dest -> liftIO $ do liftE $ mergeFileTree path inst GHC (mkTVer ver) $ \source dest -> do
mtime <- ifM (pathIsSymbolicLink source) (pure Nothing) (Just <$> getModificationTime source) mtime <- liftIO $ ifM (pathIsSymbolicLink source) (pure Nothing) (Just <$> getModificationTime source)
moveFilePortable source dest when forceInstall $ hideError doesNotExistErrorType $ hideError InappropriateType $ recycleFile dest
forM_ mtime $ setModificationTime dest liftIO $ moveFilePortable source dest
forM_ mtime $ liftIO . setModificationTime dest
| otherwise = do | otherwise = do
PlatformRequest {..} <- lift getPlatformReq PlatformRequest {..} <- lift getPlatformReq