diff options
author | Joey Hess <id@joeyh.name> | 2013-05-11 15:03:00 -0500 |
---|---|---|
committer | Joey Hess <id@joeyh.name> | 2013-05-11 15:03:00 -0500 |
commit | d0fa82fb721cdc85438287e29a94cb796b7bc464 (patch) | |
tree | 26a2486b8e715b5937ce41679eafd42c02f2310a /Command/Fsck.hs | |
parent | 679eaf6077375c5d59501d12c79e0891cbdd904f (diff) |
git-annex now builds on Windows (doesn't work)
Diffstat (limited to 'Command/Fsck.hs')
-rwxr-xr-x | Command/Fsck.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs index c63bc3ea0..fe1d35162 100755 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -9,6 +9,8 @@ module Command.Fsck where +import System.PosixCompat.Files + import Common.Annex import Command import qualified Annex @@ -30,8 +32,10 @@ import qualified Option import Types.Key import Utility.HumanTime -#ifndef mingw32_HOST_OS +#ifndef __WINDOWS__ import System.Posix.Process (getProcessID) +#else +import System.Random (getStdRandom, random) #endif import Data.Time.Clock.POSIX import Data.Time @@ -142,10 +146,14 @@ performRemote key file backend numcopies remote = , checkKeyNumCopies key file numcopies ] withtmp a = do - pid <- liftIO getProcessID +#ifndef __WINDOWS__ + v <- liftIO getProcessID +#else + v <- liftIO (getStdRandom random :: IO Int) +#endif t <- fromRepo gitAnnexTmpDir createAnnexDirectory t - let tmp = t </> "fsck" ++ show pid ++ "." ++ keyFile key + let tmp = t </> "fsck" ++ show v ++ "." ++ keyFile key let cleanup = liftIO $ catchIO (removeFile tmp) (const noop) cleanup cleanup `after` a tmp @@ -453,7 +461,9 @@ recordFsckTime key = do parent <- parentDir <$> calcRepo (gitAnnexLocation key) liftIO $ void $ tryIO $ do touchFile parent +#ifndef __WINDOWS__ setSticky parent +#endif getFsckTime :: Key -> Annex (Maybe EpochTime) getFsckTime key = do |