@@ -10,7 +10,11 @@ module ProjectM36.Persist (writeFileSync,
1010import qualified System.Win32 as Win32
1111#else
1212import qualified System.Posix as Posix
13+#if defined(linux_HOST_OS)
1314import System.Posix.Unistd (fileSynchroniseDataOnly)
15+#else
16+import System.Posix.Unistd (fileSynchronise)
17+#endif
1418import System.Posix.IO (handleToFd)
1519import Foreign.C
1620#endif
@@ -51,8 +55,11 @@ syncHandle :: DiskSync -> Handle -> IO ()
5155syncHandle FsyncDiskSync handle = do
5256#if defined(mingw32_HOST_OS)
5357 withHandleToHANDLE handle (\h -> Win32.flushFileBuffers h)
54−#else
58+#elif defined(linux_HOST_OS)
59+ --fdatasync doesn't exist on macOS
5560 handleToFd handle >>= fileSynchroniseDataOnly
61+#else
62+ handleToFd handle >>= fileSynchronise
5663#endif
5764syncHandle NoDiskSync _ = pure ()
5865