diff options
author | 2013-05-11 15:03:00 -0500 | |
---|---|---|
committer | 2013-05-11 15:03:00 -0500 | |
commit | d0fa82fb721cdc85438287e29a94cb796b7bc464 (patch) | |
tree | 26a2486b8e715b5937ce41679eafd42c02f2310a /Annex/LockPool.hs | |
parent | 679eaf6077375c5d59501d12c79e0891cbdd904f (diff) |
git-annex now builds on Windows (doesn't work)
Diffstat (limited to 'Annex/LockPool.hs')
-rwxr-xr-x[-rw-r--r--] | Annex/LockPool.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Annex/LockPool.hs b/Annex/LockPool.hs index 45fc55b3c..d8bc08485 100644..100755 --- a/Annex/LockPool.hs +++ b/Annex/LockPool.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Annex.LockPool where import qualified Data.Map as M @@ -20,17 +22,24 @@ lockFile file = go =<< fromPool file where go (Just _) = noop -- already locked go Nothing = do +#ifndef __WINDOWS__ mode <- annexFileMode fd <- liftIO $ noUmask mode $ openFd file ReadOnly (Just mode) defaultFileFlags liftIO $ waitToSetLock fd (ReadLock, AbsoluteSeek, 0, 0) +#else + liftIO $ writeFile file "" + let fd = 0 +#endif changePool $ M.insert file fd unlockFile :: FilePath -> Annex () unlockFile file = maybe noop go =<< fromPool file where go fd = do +#ifndef __WINDOWS__ liftIO $ closeFd fd +#endif changePool $ M.delete file getPool :: Annex (M.Map FilePath Fd) |