windows build warning fixes
This commit is contained in:
parent
6ca08f02a4
commit
ea765ec022
2 changed files with 6 additions and 5 deletions
|
@ -176,8 +176,6 @@ lockContent key a = do
|
||||||
(const $ a $ ContentLock key )
|
(const $ a $ ContentLock key )
|
||||||
where
|
where
|
||||||
alreadylocked = error "content is locked"
|
alreadylocked = error "content is locked"
|
||||||
failedtolock e = error $ "failed to lock content: " ++ show e
|
|
||||||
trylock locker = locker `catchIO` failedtolock
|
|
||||||
cleanuplockfile lockfile = modifyContent lockfile $
|
cleanuplockfile lockfile = modifyContent lockfile $
|
||||||
void $ liftIO $ tryIO $
|
void $ liftIO $ tryIO $
|
||||||
nukeFile lockfile
|
nukeFile lockfile
|
||||||
|
@ -197,6 +195,9 @@ lockContent key a = do
|
||||||
unlock mlockfile lck = do
|
unlock mlockfile lck = do
|
||||||
maybe noop cleanuplockfile mlockfile
|
maybe noop cleanuplockfile mlockfile
|
||||||
liftIO $ dropLock lck
|
liftIO $ dropLock lck
|
||||||
|
|
||||||
|
failedtolock e = error $ "failed to lock content: " ++ show e
|
||||||
|
trylock locker = locker `catchIO` failedtolock
|
||||||
#else
|
#else
|
||||||
lock _ (Just lockfile) = do
|
lock _ (Just lockfile) = do
|
||||||
modifyContent lockfile $
|
modifyContent lockfile $
|
||||||
|
|
|
@ -13,7 +13,6 @@ module Utility.Directory where
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.IfElse
|
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
@ -25,10 +24,11 @@ import Prelude
|
||||||
import qualified System.Win32 as Win32
|
import qualified System.Win32 as Win32
|
||||||
#else
|
#else
|
||||||
import qualified System.Posix as Posix
|
import qualified System.Posix as Posix
|
||||||
|
import Utility.SafeCommand
|
||||||
|
import Control.Monad.IfElse
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
import Utility.PosixFiles
|
import Utility.PosixFiles
|
||||||
import Utility.SafeCommand
|
|
||||||
import Utility.Tmp
|
import Utility.Tmp
|
||||||
import Utility.Exception
|
import Utility.Exception
|
||||||
import Utility.Monad
|
import Utility.Monad
|
||||||
|
@ -126,7 +126,7 @@ moveFile src dest = tryIO (rename src dest) >>= onrename
|
||||||
#else
|
#else
|
||||||
r <- tryIO $ copyFile src tmp
|
r <- tryIO $ copyFile src tmp
|
||||||
let (ok, e') = case r of
|
let (ok, e') = case r of
|
||||||
Left e' -> (False, e')
|
Left err -> (False, err)
|
||||||
Right _ -> (True, e)
|
Right _ -> (True, e)
|
||||||
#endif
|
#endif
|
||||||
unless ok $ do
|
unless ok $ do
|
||||||
|
|
Loading…
Reference in a new issue