wizard-wipeout/src-server/Server/Util.hs
2023-12-09 14:18:10 +01:00

16 lines
361 B
Haskell

module Server.Util where
import Control.Exception
import System.Directory
import System.IO.Error
-- | Remove a file if it exists
removeIfExists
:: FilePath -- File to remove
-> IO ()
removeIfExists fileName = removeFile fileName `catch` handleExists
where handleExists e
| isDoesNotExistError e = return ()
| otherwise = throwIO e