summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-21 11:48:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-21 11:48:57 -0400
commit73704a6f25d0071d809696a7b4d8785ed2dc87a8 (patch)
tree52eb0c5cb37ebeae45ea835d8916f0f63477fcdc
parent901f2c9e218cdba36e2488c413f9e620337f3283 (diff)
parentb1744e49f938c24813796819a22ae7ba05c77df0 (diff)
Merge branch 'master' into xmpp
-rw-r--r--Utility/Directory.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index 9477ad5b9..0a7690b44 100644
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Utility.Directory where
import System.IO.Error
@@ -85,9 +87,14 @@ moveFile src dest = tryIO (rename src dest) >>= onrename
(Left _) -> return False
(Right s) -> return $ isDirectory s
-{- Removes a file, which may or may not exist.
+{- Removes a file, which may or may not exist, and does not have to
+ - be a regular file.
-
- Note that an exception is thrown if the file exists but
- cannot be removed. -}
nukeFile :: FilePath -> IO ()
-nukeFile file = whenM (doesFileExist file) $ removeFile file
+#ifndef mingw32_HOST_OS
+nukeFile = removeLink
+#else
+nukeFile = removeFile
+#endif