on master help sign in
fix file-locking on Windows

I thought I already fixed this...

commit6b6dabacc9637e1a76df98f537a7b44263b31eb5 authorAgentM <agentm@themactionfaction.com> dateFri 17 Nov 2017, 18:32 (9 years ago) parentc57dea5
2 files changed+4−4
project-m36.cabal+1 src/lib/ProjectM36/FileLock.hs+3−4
project-m36.cabal+1
@@ -478,6 +478,7 @@ Test-Suite test-transactiongraph-automerge
478478 type: exitcode-stdio-1.0
479479 main-is: test/TransactionGraph/Automerge.hs
480480 Build-Depends: base, HUnit, Cabal, containers, hashable, unordered-containers, mtl, vector, vector-binary-instances, time, hashable-time, bytestring, uuid, stm, deepseq, deepseq-generics, binary, parallel, cassava, attoparsec, gnuplot, directory, temporary, haskeline, megaparsec, text, base64-bytestring, data-interval, filepath, transformers, stm-containers, list-t, websockets, optparse-applicative, network, aeson, project-m36, random, MonadRandom, semigroups
481+ Other-Modules: TutorialD.Interpreter, TutorialD.Interpreter.Base, TutorialD.Interpreter.DatabaseContextExpr, TutorialD.Interpreter.DatabaseContextIOOperator, TutorialD.Interpreter.Export.Base, TutorialD.Interpreter.Export.CSV, TutorialD.Interpreter.Import.Base, TutorialD.Interpreter.Import.BasicExamples, TutorialD.Interpreter.Import.CSV, TutorialD.Interpreter.Import.TutorialD, TutorialD.Interpreter.InformationOperator, TutorialD.Interpreter.RODatabaseContextOperator, TutorialD.Interpreter.RelationalExpr, TutorialD.Interpreter.SchemaOperator, TutorialD.Interpreter.TestBase, TutorialD.Interpreter.TransGraphRelationalOperator, TutorialD.Interpreter.TransactionGraphOperator, TutorialD.Interpreter.Types
481482 Default-Extensions: OverloadedStrings
482483 GHC-Options: -Wall
483484 Hs-Source-Dirs: ./src/bin, ., test/
src/lib/ProjectM36/FileLock.hs+3−4
@@ -2,11 +2,9 @@
22--cross-platform file locking utilizing POSIX file locking on Unix/Linux and Windows file locking
33--hackage's System.FileLock doesn't support POSIX advisory locks nor locking file based on file descriptors, hence this needless rewrite
44module ProjectM36.FileLock where
5−import System.IO
65
76
87#if defined(mingw32_HOST_OS)
9−import ProjectM36.Win32Handle
108import System.Win32.Types
119import Foreign.Marshal.Alloc
1210import System.Win32.File
@@ -30,10 +28,10 @@ openLockFile :: FilePath -> IO LockFile
3028openLockFile path = createFile path
3129 (gENERIC_READ .|. gENERIC_WRITE)
3230 (fILE_SHARE_READ .|. fILE_SHARE_WRITE)
33− nullPtr
31+ Nothing
3432 oPEN_ALWAYS
3533 fILE_ATTRIBUTE_NORMAL
36− nullPtr
34+ Nothing
3735
3836closeLockFile :: LockFile -> IO ()
3937closeLockFile file = do
@@ -73,6 +71,7 @@ unlockFile winHandle = do
7371import qualified System.Posix.IO as P
7472import System.Posix.Types
7573import System.Posix.Files
74+import System.IO
7675
7776lockStruct :: P.LockRequest -> P.FileLock
7877lockStruct req = (req, AbsoluteSeek, 0, 0)