
According to https://github.com/redneb/disk-free-space/issues/3 , disk-free-space should be at least as portable as my homegrown code was. One change I noticed is, getDiskSize was not implemented for windows in the old code, and should work now.
23 lines
486 B
Haskell
23 lines
486 B
Haskell
{- disk free space checking shim
|
|
-
|
|
- Copyright 2016 Joey Hess <id@joeyh.name>
|
|
-
|
|
- License: BSD-2-clause
|
|
-}
|
|
|
|
{-# OPTIONS_GHC -fno-warn-tabs #-}
|
|
|
|
module Utility.DiskFree (
|
|
getDiskFree,
|
|
getDiskSize
|
|
) where
|
|
|
|
import System.DiskSpace
|
|
import Utility.Applicative
|
|
import Utility.Exception
|
|
|
|
getDiskFree :: FilePath -> IO (Maybe Integer)
|
|
getDiskFree = catchMaybeIO . getAvailSpace
|
|
|
|
getDiskSize :: FilePath -> IO (Maybe Integer)
|
|
getDiskSize = fmap diskTotal <$$> catchMaybeIO . getDiskUsage
|