matchexpression: New plumbing command to check if a preferred content expression matches some data.
This commit is contained in:
parent
4b569c9e7f
commit
d3ba9fe5c8
10 changed files with 186 additions and 11 deletions
|
@ -13,13 +13,15 @@ import Control.Exception (bracket)
|
|||
import System.IO
|
||||
#endif
|
||||
|
||||
type FileSize = Integer
|
||||
|
||||
{- Gets the size of a file.
|
||||
-
|
||||
- This is better than using fileSize, because on Windows that returns a
|
||||
- FileOffset which maxes out at 2 gb.
|
||||
- See https://github.com/jystic/unix-compat/issues/16
|
||||
-}
|
||||
getFileSize :: FilePath -> IO Integer
|
||||
getFileSize :: FilePath -> IO FileSize
|
||||
#ifndef mingw32_HOST_OS
|
||||
getFileSize f = fmap (fromIntegral . fileSize) (getFileStatus f)
|
||||
#else
|
||||
|
@ -27,7 +29,7 @@ getFileSize f = bracket (openFile f ReadMode) hClose hFileSize
|
|||
#endif
|
||||
|
||||
{- Gets the size of the file, when its FileStatus is already known. -}
|
||||
getFileSize' :: FilePath -> FileStatus -> IO Integer
|
||||
getFileSize' :: FilePath -> FileStatus -> IO FileSize
|
||||
#ifndef mingw32_HOST_OS
|
||||
getFileSize' _ s = return $ fromIntegral $ fileSize s
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue