use unix-compat 0.5 on windows

That version has my patches for the problems that Utility.PosixFiles
was working around, so am able to get rid of that module now.

This will later allow bringing back the custom-setup stanza in the cabal
file. It will need to depend on unix-compat 0.5 on all OS's, which I'm
not ready to do yet.

This commit was sponsored by Nick Daly on Patreon.
This commit is contained in:
Joey Hess 2017-11-09 12:47:05 -04:00
parent 0f150a054b
commit 3ec579f5e1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
9 changed files with 12 additions and 51 deletions

View file

@ -50,6 +50,7 @@ module Annex.Content (
) where
import System.IO.Unsafe (unsafeInterleaveIO)
import System.PosixCompat.Files
import qualified Data.Set as S
import Annex.Common
@ -84,7 +85,6 @@ import Types.Key
import Annex.UUID
import Annex.InodeSentinal
import Utility.InodeCache
import Utility.PosixFiles
{- Checks if a given key's content is currently present. -}
inAnnex :: Key -> Annex Bool

View file

@ -15,11 +15,11 @@ import qualified Git.BuildVersion
import Utility.Path
import Utility.SafeCommand
import Utility.Directory
import Utility.PosixFiles
import Utility.Exception
import System.IO
import System.FilePath
import System.PosixCompat.Files
import Data.List
import Control.Monad
import Control.Monad.IfElse

View file

@ -18,6 +18,7 @@ import System.IO as X hiding (FilePath)
import System.Posix.IO as X hiding (createPipe)
#endif
import System.Exit as X
import System.PosixCompat.Files as X hiding (fileSize)
import Utility.Misc as X
import Utility.Exception as X
@ -28,7 +29,6 @@ import Utility.Directory as X
import Utility.Monad as X
import Utility.Data as X
import Utility.Applicative as X
import Utility.PosixFiles as X hiding (fileSize)
import Utility.FileSize as X
import Utility.Network as X
import Utility.Split as X

View file

@ -11,7 +11,7 @@ import Common hiding (isDirectory)
import Utility.DirWatcher.Types
import System.Win32.Notify
import qualified Utility.PosixFiles as Files
import qualified System.PosixCompat.Files as Files
watchDir :: FilePath -> (FilePath -> Bool) -> Bool -> WatchHooks -> IO WatchManager
watchDir dir ignored scanevents hooks = do

View file

@ -16,6 +16,7 @@ module Utility.Directory (
import System.IO.Error
import Control.Monad
import System.FilePath
import System.PosixCompat.Files
import Control.Applicative
import Control.Concurrent
import System.IO.Unsafe (unsafeInterleaveIO)
@ -31,7 +32,6 @@ import Control.Monad.IfElse
#endif
import Utility.SystemDirectory
import Utility.PosixFiles
import Utility.Tmp
import Utility.Exception
import Utility.Monad

View file

@ -15,7 +15,7 @@ module Utility.FileMode (
import System.IO
import Control.Monad
import System.PosixCompat.Types
import Utility.PosixFiles
import System.PosixCompat.Files
#ifndef mingw32_HOST_OS
import System.Posix.Files
import Control.Monad.IO.Class (liftIO)

View file

@ -1,42 +0,0 @@
{- POSIX files (and compatablity wrappers).
-
- This is like System.PosixCompat.Files, but with a few fixes.
-
- Copyright 2014 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.PosixFiles (
module X,
rename
) where
import System.PosixCompat.Files as X hiding (rename)
#ifndef mingw32_HOST_OS
import System.Posix.Files (rename)
#else
import qualified System.Win32.File as Win32
import qualified System.Win32.HardLink as Win32
#endif
{- System.PosixCompat.Files.rename on Windows calls renameFile,
- so cannot rename directories.
-
- Instead, use Win32 moveFile, which can. It needs to be told to overwrite
- any existing file. -}
#ifdef mingw32_HOST_OS
rename :: FilePath -> FilePath -> IO ()
rename src dest = Win32.moveFileEx src dest Win32.mOVEFILE_REPLACE_EXISTING
#endif
{- System.PosixCompat.Files.createLink throws an error, but windows
- does support hard links. -}
#ifdef mingw32_HOST_OS
createLink :: FilePath -> FilePath -> IO ()
createLink = Win32.createHardLink
#endif

View file

@ -15,13 +15,13 @@ import Control.Monad.IfElse
import System.FilePath
import System.Directory
import Control.Monad.IO.Class
import System.PosixCompat.Files
#ifndef mingw32_HOST_OS
import System.Posix.Temp (mkdtemp)
#endif
import Utility.Exception
import Utility.FileSystemEncoding
import Utility.PosixFiles
type Template = String

View file

@ -380,7 +380,11 @@ Executable git-annex
Build-Depends: network (< 2.6), network (>= 2.4)
if (os(windows))
Build-Depends: Win32 (== 2.3.1.1), Win32-extras, unix-compat (>= 0.4.1.3), setenv,
Build-Depends:
Win32 (== 2.3.1.1),
Win32-extras,
unix-compat (>= 0.5),
setenv,
process (>= 1.4.2.0)
else
Build-Depends: unix
@ -1026,7 +1030,6 @@ Executable git-annex
Utility.PartialPrelude
Utility.Path
Utility.Percentage
Utility.PosixFiles
Utility.Process
Utility.Process.Shim
Utility.QuickCheck