on master help sign in
fix Win32 moveFileEx API variation
4eef866AgentM
project-m36.cabal+5−3
@@ -101,11 +101,13 @@ Library
101 ProjectM36.FileLock,
101 ProjectM36.FileLock,
102 ProjectM36.FSType,
102 ProjectM36.FSType,
103 ProjectM36.Arbitrary
103 ProjectM36.Arbitrary
104− GHC-Options: -Wall -rdynamic
104+ GHC-Options: -Wall
105 if os(windows)
105 if os(windows)
106 Build-Depends: Win32 >= 2.5.4.1
106 Build-Depends: Win32 >= 2.5.4.1
107 Other-Modules: ProjectM36.Win32Handle
107 Other-Modules: ProjectM36.Win32Handle
108 else
108 else
109+ --219- too many exported symbols under Windows and GHC 8.4
110+ GHC-Options: -rdynamic
109 C-sources: cbits/DirectoryFsync.c, cbits/darwin_statfs.c
111 C-sources: cbits/DirectoryFsync.c, cbits/darwin_statfs.c
110 Build-Depends: unix
112 Build-Depends: unix
111 CC-Options: -fPIC
113 CC-Options: -fPIC
@@ -175,8 +177,8 @@ Executable tutd
175 TutorialD.Interpreter.TransGraphRelationalOperator,
177 TutorialD.Interpreter.TransGraphRelationalOperator,
176 TutorialD.Interpreter.SchemaOperator
178 TutorialD.Interpreter.SchemaOperator
177 main-is: TutorialD/tutd.hs
179 main-is: TutorialD/tutd.hs
178− CC-Options: -fPIC
180+ CC-Options: -fPIC -rdynamic
179− GHC-Options: -Wall -rdynamic -threaded
181+ GHC-Options: -Wall -threaded
180 Hs-Source-Dirs: ./src/bin
182 Hs-Source-Dirs: ./src/bin
181 Default-Language: Haskell2010
183 Default-Language: Haskell2010
182 Default-Extensions: OverloadedStrings
184 Default-Extensions: OverloadedStrings
src/lib/ProjectM36/Persist.hs+8−5
@@ -66,7 +66,13 @@ renameSync sync srcPath dstPath = do
66atomicRename :: FilePath -> FilePath -> IO ()
66atomicRename :: FilePath -> FilePath -> IO ()
67atomicRename srcPath dstPath =
67atomicRename srcPath dstPath =
68#if defined(mingw32_HOST_OS)
68#if defined(mingw32_HOST_OS)
69+#if MIN_VERSION_Win32(2,6,0)
70+ let dst = Just dstPath
71+#else
72+ let dst = dstPath
73+#endif
74+ in
69− Win32.moveFileEx srcPath dstPath Win32.mOVEFILE_REPLACE_EXISTING
75+ Win32.moveFileEx srcPath dst Win32.mOVEFILE_REPLACE_EXISTING
70#else
76#else
71 Posix.rename srcPath dstPath
77 Posix.rename srcPath dstPath
72#endif
78#endif
@@ -119,13 +125,10 @@ printFdCount =
119 putStrLn "Fd count not supported on this OS."
125 putStrLn "Fd count not supported on this OS."
120#endif
126#endif
121
127
122−
123−fdCount :: IO Int
124#if FDCOUNTSUPPORTED
128#if FDCOUNTSUPPORTED
129+fdCount :: IO Int
125fdCount = do
130fdCount = do
126 fds <- getDirectoryContents FDDIR
131 fds <- getDirectoryContents FDDIR
127 pure ((length fds) - 2)
132 pure ((length fds) - 2)
128−#else
129--not supported on non-linux
133--not supported on non-linux
130−fdCount = pure 0
131#endif
134#endif