From 234feea88c2edd6eac5199c1223dd10d09badbd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 30 Jun 2024 17:43:28 +0200 Subject: Windows support for filesystem storage --- src/windows/Erebos/Storage/Platform.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/windows/Erebos/Storage/Platform.hs (limited to 'src/windows/Erebos/Storage/Platform.hs') diff --git a/src/windows/Erebos/Storage/Platform.hs b/src/windows/Erebos/Storage/Platform.hs new file mode 100644 index 0000000..76c940b --- /dev/null +++ b/src/windows/Erebos/Storage/Platform.hs @@ -0,0 +1,13 @@ +module Erebos.Storage.Platform ( + createFileExclusive, +) where + +import Data.Bits + +import System.IO +import System.Win32.File +import System.Win32.Types + +createFileExclusive :: FilePath -> IO Handle +createFileExclusive path = do + hANDLEToHandle =<< createFile path gENERIC_WRITE (fILE_SHARE_READ .|. fILE_SHARE_DELETE) Nothing cREATE_NEW fILE_ATTRIBUTE_NORMAL Nothing -- cgit v1.2.3