Revert "use unix-compat 0.5 on windows"

This reverts commit 3ec579f5e1.

Too early for this; needs newer Win32 version. Le sigh.
This commit is contained in:
Joey Hess 2017-11-09 15:14:00 -04:00
parent 89f8777b6a
commit 5f55082d10
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
10 changed files with 51 additions and 13 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

42
Utility/PosixFiles.hs Normal file
View file

@ -0,0 +1,42 @@
{- 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.FilePath
import System.Directory import System.Directory
import Control.Monad.IO.Class import Control.Monad.IO.Class
import System.PosixCompat.Files
#ifndef mingw32_HOST_OS #ifndef mingw32_HOST_OS
import System.Posix.Temp (mkdtemp) import System.Posix.Temp (mkdtemp)
#endif #endif
import Utility.Exception import Utility.Exception
import Utility.FileSystemEncoding import Utility.FileSystemEncoding
import Utility.PosixFiles
type Template = String type Template = String

View file

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

View file

@ -25,7 +25,6 @@ extra-deps:
- bloomfilter-2.0.1.0 - bloomfilter-2.0.1.0
- torrent-10000.1.1 - torrent-10000.1.1
- yesod-default-1.2.0 - yesod-default-1.2.0
- unix-compat-0.5
explicit-setup-deps: explicit-setup-deps:
git-annex: true git-annex: true
resolver: lts-9.10 resolver: lts-9.10