summaryrefslogtreecommitdiff
path: root/Utility/FileSize.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-11-11 15:01:13 -0400
committerJoey Hess <joeyh@joeyh.name>2016-11-11 15:01:13 -0400
commit962e279e17c1f3cf3be49ffdfb5e7310711a220c (patch)
treed9953d9e57dea51c24ccaf4d7e64731010546f4f /Utility/FileSize.hs
parent7d7f93302c72cbe1a16598b0c90a49c10aaf3669 (diff)
downloadgit-repair-962e279e17c1f3cf3be49ffdfb5e7310711a220c.tar.gz
merge from git-annex
Diffstat (limited to 'Utility/FileSize.hs')
-rw-r--r--Utility/FileSize.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Utility/FileSize.hs b/Utility/FileSize.hs
index 1055754..5f89cff 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