summaryrefslogtreecommitdiff
path: root/Utility/FileSize.hs
diff options
context:
space:
mode:
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