on master help sign in
Merge branch 'windows_support' of https://github.com/agentm/project-m36 into windows_support
f1dfb09AgentM
ProjectM36/Persist.hs+3−3
@@ -7,7 +7,7 @@ module ProjectM36.Persist (writeFileSync,
7-- on Windows, use FlushFileBuffers and MoveFileEx
7-- on Windows, use FlushFileBuffers and MoveFileEx
8
8
9#if defined(mingw32_HOST_OS)
9#if defined(mingw32_HOST_OS)
10−import System.Win32.File (flushFileBuffers)
10+import qualified System.Win32 as Win32
11#else
11#else
12import qualified System.Posix as Posix
12import qualified System.Posix as Posix
13import System.Posix.Unistd (fileSynchroniseDataOnly)
13import System.Posix.Unistd (fileSynchroniseDataOnly)
@@ -41,7 +41,7 @@ renameSync sync srcPath dstPath = do
41-- System.Directory's renameFile/renameDirectory almost do exactly what we want except that it needlessly differentiates between directories and files
41-- System.Directory's renameFile/renameDirectory almost do exactly what we want except that it needlessly differentiates between directories and files
42atomicRename :: FilePath -> FilePath -> IO ()
42atomicRename :: FilePath -> FilePath -> IO ()
43atomicRename srcPath dstPath = do
43atomicRename srcPath dstPath = do
44−#if defined(ming32_HOST_OS)
44+#if defined(mingw32_HOST_OS)
45 Win32.moveFileEx srcPath dstPath Win32.mOVEFILE_REPLACE_EXISTING
45 Win32.moveFileEx srcPath dstPath Win32.mOVEFILE_REPLACE_EXISTING
46#else
46#else
47 Posix.rename srcPath dstPath
47 Posix.rename srcPath dstPath
@@ -50,7 +50,7 @@ atomicRename srcPath dstPath = do
50syncHandle :: DiskSync -> Handle -> IO ()
50syncHandle :: DiskSync -> Handle -> IO ()
51syncHandle FsyncDiskSync handle = do
51syncHandle FsyncDiskSync handle = do
52#if defined(mingw32_HOST_OS)
52#if defined(mingw32_HOST_OS)
53− withHandleToHANDLE handle (\h -> flushFileBuffers h)
53+ withHandleToHANDLE handle (\h -> Win32.flushFileBuffers h)
54#else
54#else
55 handleToFd handle >>= fileSynchroniseDataOnly
55 handleToFd handle >>= fileSynchroniseDataOnly
56#endif
56#endif