summaryrefslogtreecommitdiff
path: root/Annex/Journal.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <id@joeyh.name>2013-05-11 15:03:00 -0500
committerGravatar Joey Hess <id@joeyh.name>2013-05-11 15:03:00 -0500
commitd0fa82fb721cdc85438287e29a94cb796b7bc464 (patch)
tree26a2486b8e715b5937ce41679eafd42c02f2310a /Annex/Journal.hs
parent679eaf6077375c5d59501d12c79e0891cbdd904f (diff)
git-annex now builds on Windows (doesn't work)
Diffstat (limited to 'Annex/Journal.hs')
-rwxr-xr-x[-rw-r--r--]Annex/Journal.hs22
1 files changed, 17 insertions, 5 deletions
diff --git a/Annex/Journal.hs b/Annex/Journal.hs
index 2df5294ee..f86d03cf6 100644..100755
--- a/Annex/Journal.hs
+++ b/Annex/Journal.hs
@@ -9,6 +9,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Annex.Journal where
import System.IO.Binary
@@ -77,13 +79,23 @@ fileJournal = replace "//" "_" . replace "_" "/"
- contention with other git-annex processes. -}
lockJournal :: Annex a -> Annex a
lockJournal a = do
- file <- fromRepo gitAnnexJournalLock
- createAnnexDirectory $ takeDirectory file
+ lockfile <- fromRepo gitAnnexJournalLock
+ createAnnexDirectory $ takeDirectory lockfile
mode <- annexFileMode
- bracketIO (lock file mode) unlock a
+ bracketIO (lock lockfile mode) unlock a
where
- lock file mode = do
- l <- noUmask mode $ createFile file mode
+ lock lockfile mode = do
+#ifndef __WINDOWS__
+ l <- noUmask mode $ createFile lockfile mode
waitToSetLock l (WriteLock, AbsoluteSeek, 0, 0)
return l
+#else
+ writeFile lockfile ""
+ return lockfile
+#endif
+#ifndef __WINDOWS__
unlock = closeFd
+#else
+ unlock = removeFile
+#endif
+