aboutsummaryrefslogtreecommitdiffstats
path: root/src/System
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-04-17 22:41:53 +0200
committertv <tv@krebsco.de>2020-04-17 23:11:07 +0200
commit7dfc802b753f21afcb656b13d30d49bc548ac150 (patch)
tree664d84c3f6ec28b7affc26b509ddc608bd06939d /src/System
parentd6d51de7c9d54691b33a8ae9691fd0402259006a (diff)
Reaktor.API: make configurable
Diffstat (limited to 'src/System')
-rw-r--r--src/System/Posix/Files/Extended.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/System/Posix/Files/Extended.hs b/src/System/Posix/Files/Extended.hs
new file mode 100644
index 0000000..da82359
--- /dev/null
+++ b/src/System/Posix/Files/Extended.hs
@@ -0,0 +1,17 @@
+module System.Posix.Files.Extended
+ ( module Exports
+ , removeIfExists
+ ) where
+
+import qualified System.Posix.Files as Exports
+
+import Control.Exception (catch, throwIO)
+import System.IO.Error (isDoesNotExistError)
+import System.Posix.Files (removeLink)
+
+removeIfExists :: FilePath -> IO ()
+removeIfExists fileName = removeLink fileName `catch` handleExists
+ where handleExists e
+ | isDoesNotExistError e = return ()
+ | otherwise = throwIO e
+