summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-29 15:19:03 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-29 15:19:03 -0400
commit2f4061cce0eb1189d194cef6ef2e446da53cd854 (patch)
treef13a6b7066184d710e32f149b83e5bebc6b3e214
parent322f68bda7305803b18598f9123a17377c8421ff (diff)
Windows: Avoid using unix-compat's rename, which refuses to rename directories.
-rw-r--r--Annex/Content.hs1
-rw-r--r--CmdLine/Seek.hs2
-rw-r--r--Command/Add.hs2
-rw-r--r--Command/Fix.hs2
-rw-r--r--Command/FromKey.hs2
-rw-r--r--Command/Fsck.hs2
-rw-r--r--Command/Import.hs2
-rw-r--r--Command/Indirect.hs1
-rw-r--r--Command/Info.hs1
-rw-r--r--Command/RecvKey.hs2
-rw-r--r--Common.hs2
-rw-r--r--Limit.hs1
-rw-r--r--Test.hs1
-rw-r--r--Utility/DirWatcher/Win32Notify.hs2
-rw-r--r--Utility/Directory.hs2
-rw-r--r--Utility/PosixFiles.hs30
-rw-r--r--debian/changelog2
17 files changed, 35 insertions, 22 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 98603914a..45e1fa182 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -35,7 +35,6 @@ module Annex.Content (
) where
import System.IO.Unsafe (unsafeInterleaveIO)
-import System.PosixCompat.Files
import Common.Annex
import Logs.Location
diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs
index c3becefde..e95b9f005 100644
--- a/CmdLine/Seek.hs
+++ b/CmdLine/Seek.hs
@@ -11,8 +11,6 @@
module CmdLine.Seek where
-import System.PosixCompat.Files
-
import Common.Annex
import Types.Command
import Types.Key
diff --git a/Command/Add.hs b/Command/Add.hs
index ffa27504a..d1dcb6025 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -9,8 +9,6 @@
module Command.Add where
-import System.PosixCompat.Files
-
import Common.Annex
import Annex.Exception
import Command
diff --git a/Command/Fix.hs b/Command/Fix.hs
index 9339585d1..f730226e3 100644
--- a/Command/Fix.hs
+++ b/Command/Fix.hs
@@ -9,8 +9,6 @@
module Command.Fix where
-import System.PosixCompat.Files
-
import Common.Annex
import Command
import qualified Annex.Queue
diff --git a/Command/FromKey.hs b/Command/FromKey.hs
index 784731ad7..7eb62fa4e 100644
--- a/Command/FromKey.hs
+++ b/Command/FromKey.hs
@@ -7,8 +7,6 @@
module Command.FromKey where
-import System.PosixCompat.Files
-
import Common.Annex
import Command
import qualified Annex.Queue
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index b20bfc8ab..f6e4fe273 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -9,8 +9,6 @@
module Command.Fsck where
-import System.PosixCompat.Files
-
import Common.Annex
import Command
import qualified Annex
diff --git a/Command/Import.hs b/Command/Import.hs
index db0f8d3f5..db3601a1b 100644
--- a/Command/Import.hs
+++ b/Command/Import.hs
@@ -7,8 +7,6 @@
module Command.Import where
-import System.PosixCompat.Files
-
import Common.Annex
import Command
import qualified Annex
diff --git a/Command/Indirect.hs b/Command/Indirect.hs
index 0da10c579..c0dd57959 100644
--- a/Command/Indirect.hs
+++ b/Command/Indirect.hs
@@ -7,7 +7,6 @@
module Command.Indirect where
-import System.PosixCompat.Files
import Control.Exception.Extensible
import Common.Annex
diff --git a/Command/Info.hs b/Command/Info.hs
index d15fbba57..98cc49efa 100644
--- a/Command/Info.hs
+++ b/Command/Info.hs
@@ -14,7 +14,6 @@ import qualified Data.Map as M
import Text.JSON
import Data.Tuple
import Data.Ord
-import System.PosixCompat.Files
import Common.Annex
import qualified Remote
diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs
index 5d2a9c5aa..1794596c5 100644
--- a/Command/RecvKey.hs
+++ b/Command/RecvKey.hs
@@ -7,8 +7,6 @@
module Command.RecvKey where
-import System.PosixCompat.Files
-
import Common.Annex
import Command
import CmdLine
diff --git a/Common.hs b/Common.hs
index a6203b9a6..6612c9c54 100644
--- a/Common.hs
+++ b/Common.hs
@@ -15,7 +15,6 @@ import Data.String.Utils as X hiding (join)
import System.FilePath as X
import System.Directory as X
import System.IO as X hiding (FilePath)
-import System.PosixCompat.Files as X
#ifndef mingw32_HOST_OS
import System.Posix.IO as X
#endif
@@ -31,5 +30,6 @@ import Utility.Monad as X
import Utility.Data as X
import Utility.Applicative as X
import Utility.FileSystemEncoding as X
+import Utility.PosixFiles as X
import Utility.PartialPrelude as X
diff --git a/Limit.hs b/Limit.hs
index 8250544a4..bc1705bea 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -13,7 +13,6 @@ import Data.Time.Clock.POSIX
import qualified Data.Set as S
import qualified Data.Map as M
import System.Path.WildMatch
-import System.PosixCompat.Files
import Common.Annex
import qualified Annex
diff --git a/Test.hs b/Test.hs
index 0d8e0e3ef..b7f431d6c 100644
--- a/Test.hs
+++ b/Test.hs
@@ -17,7 +17,6 @@ import Test.Tasty.Ingredients.Rerun
import Data.Monoid
import Options.Applicative hiding (command)
-import System.PosixCompat.Files
import Control.Exception.Extensible
import qualified Data.Map as M
import System.IO.HVFS (SystemFS(..))
diff --git a/Utility/DirWatcher/Win32Notify.hs b/Utility/DirWatcher/Win32Notify.hs
index 27175e1c8..ba786839c 100644
--- a/Utility/DirWatcher/Win32Notify.hs
+++ b/Utility/DirWatcher/Win32Notify.hs
@@ -11,7 +11,7 @@ import Common hiding (isDirectory)
import Utility.DirWatcher.Types
import System.Win32.Notify
-import qualified System.PosixCompat.Files as Files
+import qualified Utility.PosixFiles as Files
watchDir :: FilePath -> (FilePath -> Bool) -> WatchHooks -> IO WatchManager
watchDir dir ignored hooks = do
diff --git a/Utility/Directory.hs b/Utility/Directory.hs
index 6caee7efa..c457de6e3 100644
--- a/Utility/Directory.hs
+++ b/Utility/Directory.hs
@@ -10,7 +10,6 @@
module Utility.Directory where
import System.IO.Error
-import System.PosixCompat.Files
import System.Directory
import Control.Exception (throw)
import Control.Monad
@@ -19,6 +18,7 @@ import System.FilePath
import Control.Applicative
import System.IO.Unsafe (unsafeInterleaveIO)
+import Utility.PosixFiles
import Utility.SafeCommand
import Utility.Tmp
import Utility.Exception
diff --git a/Utility/PosixFiles.hs b/Utility/PosixFiles.hs
new file mode 100644
index 000000000..2c1a05a6a
--- /dev/null
+++ b/Utility/PosixFiles.hs
@@ -0,0 +1,30 @@
+{- POSIX files (and compatablity wrappers).
+ -
+ - This is like System.PosixCompat.Files, except with a fixed rename.
+ -
+ - Copyright 2014 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+{-# LANGUAGE CPP #-}
+
+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 System.Win32.File (moveFile)
+#endif
+
+{- System.PosixCompat.Files.rename on Windows calls renameFile,
+ - so cannot rename directories. Instead, use Win32 moveFile, which can. -}
+#ifdef mingw32_HOST_OS
+rename :: FilePath -> FilePath -> IO ()
+rename = moveFile
+#endif
diff --git a/debian/changelog b/debian/changelog
index a6c45e5b0..457e79a0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ git-annex (5.20140128) UNRELEASED; urgency=medium
on Windows; the lock files have been sorted out.
* Fixed direct mode annexed content locking code, which is used to
guard against recursive file drops.
+ * Windows: Avoid using unix-compat's rename, which refuses to rename
+ directories.
-- Joey Hess <joeyh@debian.org> Tue, 28 Jan 2014 13:57:19 -0400