Fix deletion on missing files

This commit is contained in:
Julian Ospald 2022-05-20 23:28:15 +02:00
parent df89ddcdf5
commit 5741e069ad
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F

View File

@ -1808,7 +1808,7 @@ rmGHCVer ver = do
lift (getInstalledFiles GHC ver) >>= \case lift (getInstalledFiles GHC ver) >>= \case
Just files -> do Just files -> do
lift $ logInfo $ "Removing files safely from: " <> T.pack dir lift $ logInfo $ "Removing files safely from: " <> T.pack dir
forM_ files (lift . recycleFile . (\f -> dir </> dropDrive f)) forM_ files (lift . hideError NoSuchThing . recycleFile . (\f -> dir </> dropDrive f))
removeEmptyDirsRecursive dir removeEmptyDirsRecursive dir
survivors <- liftIO $ hideErrorDef [doesNotExistErrorType] [] $ listDirectory dir survivors <- liftIO $ hideErrorDef [doesNotExistErrorType] [] $ listDirectory dir
f <- recordedInstallationFile GHC ver f <- recordedInstallationFile GHC ver
@ -1892,7 +1892,7 @@ rmHLSVer ver = do
lift (getInstalledFiles HLS (mkTVer ver)) >>= \case lift (getInstalledFiles HLS (mkTVer ver)) >>= \case
Just files -> do Just files -> do
lift $ logInfo $ "Removing files safely from: " <> T.pack hlsDir lift $ logInfo $ "Removing files safely from: " <> T.pack hlsDir
forM_ files (lift . recycleFile . (\f -> hlsDir </> dropDrive f)) forM_ files (lift . hideError NoSuchThing . recycleFile . (\f -> hlsDir </> dropDrive f))
removeEmptyDirsRecursive hlsDir removeEmptyDirsRecursive hlsDir
survivors <- liftIO $ hideErrorDef [doesNotExistErrorType] [] $ listDirectory hlsDir survivors <- liftIO $ hideErrorDef [doesNotExistErrorType] [] $ listDirectory hlsDir
f <- recordedInstallationFile HLS (mkTVer ver) f <- recordedInstallationFile HLS (mkTVer ver)