Fix recyclePathForcibly on windows

This commit is contained in:
Julian Ospald 2022-02-06 22:56:22 +01:00
parent d110d20879
commit 63350dab71
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
1 changed files with 3 additions and 1 deletions

View File

@ -472,7 +472,9 @@ recyclePathForcibly fp
let dest = tmp </> takeFileName fp
liftIO (moveFile fp dest)
`catch`
(\e -> if isPermissionError e {- EXDEV on windows -} then recover (liftIO $ removePathForcibly fp) else throwIO e)
(\e -> if | isDoesNotExistError e -> pure ()
| isPermissionError e {- EXDEV on windows -} -> recover (liftIO $ removePathForcibly fp)
| otherwise -> throwIO e)
`finally`
liftIO (handleIO (\_ -> pure ()) $ removePathForcibly tmp)
| otherwise = liftIO $ removePathForcibly fp