hs-hath-1.4.0: src/Hath/DiskSpace.hs
-- | Free space on the disk that holds a path. module Hath.DiskSpace ( availableBytes ) where import Relude import System.Posix.Internals ( CFilePath, withFilePath ) foreign import ccall safe "hath_available_bytes" available :: CFilePath -> IO Int64 -- | Bytes we may still write there; Nothing if the system will not say. availableBytes :: FilePath -> IO (Maybe Int64) availableBytes path = withFilePath path available <&> \n -> n <$ guard (n >= 0)