avoid some build warnings on windows

This commit is contained in:
Joey Hess 2019-09-12 14:11:19 -04:00
parent 42bdaaa5d7
commit 53fd746705
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 15 additions and 5 deletions

View file

@ -48,10 +48,10 @@ import Annex.Perms
import Utility.FileMode
import System.Posix.User
import qualified Utility.LockFile.Posix as Posix
import Data.Either
#endif
import qualified Data.Map as M
import Data.Either
checkCanInitialize :: Annex a -> Annex a
checkCanInitialize a = inRepo (noAnnexFileContent . Git.repoWorkTree) >>= \case

View file

@ -83,5 +83,7 @@ preferredBundledPrograms = catMaybes
-- its kernel, and avoid using them if not available.
]
where
#ifndef mingw32_HOST_OS
ifset True s = Just s
ifset False _ = Nothing
#endif

View file

@ -41,7 +41,11 @@ seek = withWords (commandAction . start)
-- This runs as root, so avoid making any commits or initializing
-- git-annex, or doing other things that create root-owned files.
start :: [String] -> CommandStart
#ifndef mingw32_HOST_OS
start os = do
#else
start _os = do
#endif
uuid <- getUUID
when (uuid == NoUUID) $
giveup "This can only be run in a git-annex repository."

View file

@ -42,7 +42,6 @@ import qualified CmdLine.GitAnnexShell.Fields as Fields
import Logs.Location
import Utility.Metered
import Utility.CopyFile
import Utility.FileMode
import Utility.Env
import Utility.Batch
import Utility.SimpleProtocol
@ -61,6 +60,10 @@ import Types.NumCopies
import Annex.Action
import Messages.Progress
#ifndef mingw32_HOST_OS
import Utility.FileMode
#endif
import Control.Concurrent
import Control.Concurrent.MSampleVar
import qualified Data.Map as M
@ -719,13 +722,14 @@ newCopyCoWTried = CopyCoWTried <$> newEmptyMVar
{- Copys a file. Uses copy-on-write if it is supported. Otherwise,
- uses rsync, so that interrupted copies can be resumed. -}
rsyncOrCopyFile :: State -> [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool
rsyncOrCopyFile st rsyncparams src dest p =
#ifdef mingw32_HOST_OS
rsyncOrCopyFile _st _rsyncparams src dest p =
-- rsync is only available on Windows in some installation methods,
-- and is not strictly needed here, so don't use it.
docopywith copyFileExternal
where
#else
rsyncOrCopyFile st rsyncparams src dest p =
-- If multiple threads reach this at the same time, they
-- will both try CoW, which is acceptable.
ifM (liftIO $ isEmptyMVar copycowtried)

View file

@ -170,7 +170,9 @@ genInodeCache f delta = catchDefaultIO Nothing $
toInodeCache :: TSDelta -> FilePath -> FileStatus -> IO (Maybe InodeCache)
toInodeCache (TSDelta getdelta) f s
| isRegularFile s = do
#ifndef mingw32_HOST_OS
delta <- getdelta
#endif
sz <- getFileSize' f s
#ifdef mingw32_HOST_OS
mtime <- MTimeHighRes . utcTimeToPOSIXSeconds <$> getModificationTime f

View file

@ -10,8 +10,6 @@
module Utility.Path.Max where
import System.FilePath
#ifndef mingw32_HOST_OS
import Utility.Exception
import System.Posix.Files