summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-25 16:16:18 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-25 16:16:18 -0400
commit2d0d0b1b401cdcd9c6c1c530826a61bfc3349d12 (patch)
tree5cab04dc2cfa5d887244a4f31191158f7914a445 /Utility
parent4fcd04b876f4fc4f3738d80ef66b29a76871aa2d (diff)
matchexpression: New plumbing command to check if a preferred content expression matches some data.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/FileSize.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Utility/FileSize.hs b/Utility/FileSize.hs
index 1055754cb..5f89cff2c 100644
--- a/Utility/FileSize.hs
+++ b/Utility/FileSize.hs
@@ -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