diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-29 16:25:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-29 16:25:12 -0400 |
commit | ab26861d24c42d9b66ba8fc1463a4ee99071e8a3 (patch) | |
tree | 96cc55452c5a6ab7b0cf66f1a5c1321a9c544999 /Utility | |
parent | 98ee54531b9e92f1646396ff4a8be7a86d0c7bcb (diff) |
work around windows insanity that is 97.61% more brain-damaged than normal
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/Tmp.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Utility/Tmp.hs b/Utility/Tmp.hs index 186cd121a..8c897d749 100644 --- a/Utility/Tmp.hs +++ b/Utility/Tmp.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Utility.Tmp where import Control.Exception (bracket) @@ -62,7 +64,15 @@ withTmpDirIn :: FilePath -> Template -> (FilePath -> IO a) -> IO a withTmpDirIn tmpdir template = bracket create remove where remove d = whenM (doesDirectoryExist d) $ +#if mingw32_HOST_OS + -- Windows will often refuse to delete a file + -- after a process has just written to it and exited. + -- Because it's crap, presumably. So, ignore failure + -- to delete the temp directory. + catchIO $ removeDirectoryRecursive d +#else removeDirectoryRecursive d +#endif create = do createDirectoryIfMissing True tmpdir makenewdir (tmpdir </> template) (0 :: Int) |