From 962e279e17c1f3cf3be49ffdfb5e7310711a220c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Nov 2016 15:01:13 -0400 Subject: merge from git-annex --- Utility/FileSize.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Utility/FileSize.hs') 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 -- cgit v1.2.3