file-io 0.1.3 → 0.1.4
raw patch · 3 files changed
+25/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- file-io.cabal +1/−1
- windows/System/File/Platform.hsc +20/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for file-io +## 0.1.4 -- 2024-08-10++* fix build on GHC <= 8.10+ ## 0.1.3 -- 2024-08-08 * add `openTempFile` , `openBinaryTempFile` , `openTempFileWithDefaultPermissions` and `openBinaryTempFileWithDefaultPermissions` wrt [#2](https://github.com/hasufell/file-io/issues/2)
file-io.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: file-io-version: 0.1.3+version: 0.1.4 synopsis: Basic file IO operations via 'OsPath' description: Basic file IO operations like Prelude, but for 'OsPath'. homepage: https://github.com/hasufell/file-io
windows/System/File/Platform.hsc view
@@ -102,7 +102,7 @@ Win32.fILE_SHARE_DELETE .|. Win32.fILE_SHARE_READ - -- | Open an existing file and return the 'Handle'.+-- | Open an existing file and return the 'Handle'. openExistingFile :: WindowsPath -> IOMode -> IO Handle openExistingFile fp iomode = bracketOnError (WS.createFile@@ -168,6 +168,7 @@ #endif withTString label $ \c_template -> withTString suffix $ \c_suffix ->+#if MIN_VERSION_base(4, 15, 0) with nullPtr $ \c_ptr -> do res <- c_createUUIDTempFileErrNo c_tmp_dir c_template c_suffix c_ptr if not res@@ -178,13 +179,31 @@ free c_p let flags = fromIntegral mode .&. o_EXCL handleResultsWinIO filename (flags == o_EXCL)+#else+ -- NOTE: revisit this when new I/O manager in place and use a UUID+ -- based one when we are no longer MAX_PATH bound.+ allocaBytes (sizeOf (undefined :: CWchar) * 260) $ \c_str -> do+ res <- c_getTempFileNameErrorNo c_tmp_dir c_template c_suffix 0+ c_str+ if not res+ then do errno <- getErrno+ ioError (errnoToIOError loc errno Nothing (Just $ lenientDecode tmp_dir))+ else do filename <- peekTString c_str+ let flags = fromIntegral mode .&. o_EXCL+ handleResultsWinIO filename (flags == o_EXCL)+#endif handleResultsWinIO filename excl = do h <- (if excl then openExistingFile else openFile) filename ReadWriteMode return (filename, h) +#if MIN_VERSION_base(4, 15, 0) foreign import ccall "__createUUIDTempFileErrNo" c_createUUIDTempFileErrNo :: CWString -> CWString -> CWString -> Ptr CWString -> IO Bool+#else+foreign import ccall "getTempFileNameErrorNo" c_getTempFileNameErrorNo+ :: CWString -> CWString -> CWString -> CUInt -> Ptr CWchar -> IO Bool+#endif