log-warper-0.2.5: src/System/Wlog/FileUtils.hs
{-# LANGUAGE NoImplicitPrelude #-}
-- | Some helpers and utilites to work with files
module System.Wlog.FileUtils
( whenExist
) where
import Universum
import System.Directory (doesFileExist)
-- | Performs given action on file if file exists.
whenExist :: MonadIO m => FilePath -> (FilePath -> m ()) -> m ()
whenExist filePath action = whenM (liftIO $ doesFileExist filePath) $ action filePath