work around windows insanity that is 97.61% more brain-damaged than normal

This commit is contained in:
Joey Hess 2013-12-29 16:25:12 -04:00
parent 8befeaffa0
commit a96118ec55
2 changed files with 12 additions and 0 deletions

View file

@ -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)

View file

@ -8,3 +8,5 @@ Create a remote repository
### What version of git-annex are you using? On what operating system?
Windows 7, git-annex version 5.20131221-gf8c928d
> [[fixed|done]].. thanks for testing the assistant on windows! --[[Joey]]