diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-04-08 15:25:32 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-04-08 15:25:32 -0400 |
commit | 9e65dd757f9fe8e031ea936ce4e2a8cb998f7f83 (patch) | |
tree | 7b6e0c509838db15e079f57f176f5902e65508c5 /Utility | |
parent | fdfd56c647d685ad5618917341db0b7c97e1b63a (diff) |
hard links on windows
* annex.thin and annex.hardlink are now supported on Windows.
* unannex --fast now makes hard links on Windows.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/CopyFile.hs | 4 | ||||
-rw-r--r-- | Utility/PosixFiles.hs | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/Utility/CopyFile.hs b/Utility/CopyFile.hs index 46bc43d50..01c600504 100644 --- a/Utility/CopyFile.hs +++ b/Utility/CopyFile.hs @@ -49,13 +49,9 @@ copyFileExternal meta src dest = do {- Create a hard link if the filesystem allows it, and fall back to copying - the file. -} createLinkOrCopy :: FilePath -> FilePath -> IO Bool -#ifndef mingw32_HOST_OS createLinkOrCopy src dest = go `catchIO` const fallback where go = do createLink src dest return True fallback = copyFileExternal CopyAllMetaData src dest -#else -createLinkOrCopy = copyFileExternal CopyAllMetaData -#endif diff --git a/Utility/PosixFiles.hs b/Utility/PosixFiles.hs index 4550bebdf..37253da29 100644 --- a/Utility/PosixFiles.hs +++ b/Utility/PosixFiles.hs @@ -1,6 +1,6 @@ {- POSIX files (and compatablity wrappers). - - - This is like System.PosixCompat.Files, except with a fixed rename. + - This is like System.PosixCompat.Files, but with a few fixes. - - Copyright 2014 Joey Hess <id@joeyh.name> - @@ -21,6 +21,7 @@ import System.PosixCompat.Files as X hiding (rename) 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, @@ -32,3 +33,10 @@ import qualified System.Win32.File as Win32 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 |