diff options
author | 2013-05-11 15:03:00 -0500 | |
---|---|---|
committer | 2013-05-11 15:03:00 -0500 | |
commit | d0fa82fb721cdc85438287e29a94cb796b7bc464 (patch) | |
tree | 26a2486b8e715b5937ce41679eafd42c02f2310a /Remote/Rsync.hs | |
parent | 679eaf6077375c5d59501d12c79e0891cbdd904f (diff) |
git-annex now builds on Windows (doesn't work)
Diffstat (limited to 'Remote/Rsync.hs')
-rwxr-xr-x | Remote/Rsync.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 1c4b1d112..768c15777 100755 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -11,8 +11,10 @@ module Remote.Rsync (remote) where import qualified Data.ByteString.Lazy as L import qualified Data.Map as M -#ifndef mingw32_HOST_OS +#ifndef __WINDOWS__ import System.Posix.Process (getProcessID) +#else +import System.Random (getStdRandom, random) #endif import Common.Annex @@ -219,10 +221,14 @@ sendParams = ifM crippledFileSystem - up trees for rsync. -} withRsyncScratchDir :: (FilePath -> Annex Bool) -> Annex Bool withRsyncScratchDir 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 </> "rsynctmp" </> show pid + let tmp = t </> "rsynctmp" </> show v nuke tmp liftIO $ createDirectoryIfMissing True tmp nuke tmp `after` a tmp @@ -273,8 +279,12 @@ rsyncSend o callback k canrename src = withRsyncScratchDir $ \tmp -> do else ifM crippledFileSystem ( liftIO $ copyFileExternal src dest , do +#ifndef __WINDOWS__ liftIO $ createLink src dest return True +#else + liftIO $ copyFileExternal src dest +#endif ) ps <- sendParams if ok |